From patchwork Thu Nov 10 07:17:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dexuan Cui X-Patchwork-Id: 9420739 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D36BC60484 for ; Thu, 10 Nov 2016 08:51:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C26102939D for ; Thu, 10 Nov 2016 08:51:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5FC2295B8; Thu, 10 Nov 2016 08:51:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F3772939D for ; Thu, 10 Nov 2016 08:51:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752287AbcKJIvL (ORCPT ); Thu, 10 Nov 2016 03:51:11 -0500 Received: from mail-dm3nam03on0105.outbound.protection.outlook.com ([104.47.41.105]:2465 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751664AbcKJIvK (ORCPT ); Thu, 10 Nov 2016 03:51:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tplmcSgl7c8ncGvJERfeqCyVh00sQgOySJWcA8ZOgVc=; b=T7brpd8I+b2xLgi2iH/mfMgAcpp/a4nEWgfjQLHtxEq5D2yNbyoh66jLmfka8+vzCnaIxrGKoF1tKOsRvgYDYimXb3MT9ZczYd2jJ8V8MOFz73fogvrnTeT/Ts1/L+Uq/zBhAwANdZx3pvbyHYOKt4yK3uw1Yk7B1LgvTU2S/ug= Received: from MWHPR03MB2669.namprd03.prod.outlook.com (10.168.207.15) by MWHPR03MB2495.namprd03.prod.outlook.com (10.169.201.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.707.6; Thu, 10 Nov 2016 07:17:48 +0000 Received: from MWHPR03MB2669.namprd03.prod.outlook.com ([10.168.207.15]) by MWHPR03MB2669.namprd03.prod.outlook.com ([10.168.207.15]) with mapi id 15.01.0707.006; Thu, 10 Nov 2016 07:17:48 +0000 From: Dexuan Cui To: Bjorn Helgaas , "linux-pci@vger.kernel.org" , "devel@linuxdriverproject.org" CC: "gregkh@linuxfoundation.org" , KY Srinivasan , Haiyang Zhang , "Stephen Hemminger" , Jake Oshins , "Hadden Hoppert" , Vitaly Kuznetsov , "jasowang@redhat.com" , "apw@canonical.com" , "olaf@aepfle.de" , "linux-kernel@vger.kernel.org" Subject: [PATCH 1/3] PCI: hv: use the correct buffer size in new_pcichild_device() Thread-Topic: [PATCH 1/3] PCI: hv: use the correct buffer size in new_pcichild_device() Thread-Index: AdI7IoRA7oW02ygCRFeoAZworZG8EQ== Date: Thu, 10 Nov 2016 07:17:48 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=decui@microsoft.com; x-originating-ip: [2404:f801:9000:19::66c] x-ms-office365-filtering-correlation-id: acbe1d1c-7445-4be9-822e-08d40939ad1e x-microsoft-exchange-diagnostics: 1; MWHPR03MB2495; 7:an/R6MzMcx851LtDGmqXFKjFrNHwRDwUPJeXTi2ejClA3NrbqA/5U2jIU6c9iga0HEcXko6zL5YliutcOhX+shERHpiMd+l396KKtOmACB65M41oND3HPZPaOPfjnb9XO5SwoY7uGNWo33AMB90oKr2TOfSjeck6ML5jKr6KQRuv69RPTv+titlq0aOGg1hs1TV7emhFrK45ib6NR3sHwNkOJ8FCSaGUtXW1R6OK6KcJLjL50055YvyLaHiwrY8UlwlEEFjlJTTnsWmxbwrWyKxTntSBTlbnfzgoYfM53GgSLR0njLvU4gqXzFS5fSM4aO+JoatKvLVi0NFTo5r9G/YRla2omGmBI5Y/kvD8xO5HXIb/3i9S+lSx/I+b5wzW x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:MWHPR03MB2495; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6045074)(6060229)(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(61426038)(61427038)(6046074)(6061226); SRVR:MWHPR03MB2495; BCL:0; PCL:0; RULEID:; SRVR:MWHPR03MB2495; x-forefront-prvs: 01221E3973 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(189002)(199003)(33656002)(77096005)(86612001)(2501003)(9686002)(92566002)(2900100001)(8936002)(7736002)(74316002)(2906002)(6116002)(101416001)(8990500004)(586003)(102836003)(10090500001)(50986999)(76576001)(99286002)(10290500002)(5005710100001)(54356999)(105586002)(106356001)(4326007)(305945005)(5001770100001)(97736004)(3660700001)(5660300001)(87936001)(7846002)(7696004)(122556002)(2201001)(189998001)(68736007)(86362001)(3280700002)(8676002)(81166006)(81156014); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR03MB2495; H:MWHPR03MB2669.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2016 07:17:48.5703 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2495 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We don't really need such a big on-stack buffer. vmbus_sendpacket() here only uses sizeof(struct pci_child_message). Signed-off-by: Dexuan Cui CC: Jake Oshins Cc: KY Srinivasan CC: Haiyang Zhang CC: Vitaly Kuznetsov Acked-by: K. Y. Srinivasan --- drivers/pci/host/pci-hyperv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c index 763ff87..93ed64a 100644 --- a/drivers/pci/host/pci-hyperv.c +++ b/drivers/pci/host/pci-hyperv.c @@ -1271,9 +1271,9 @@ static struct hv_pci_dev *new_pcichild_device(struct hv_pcibus_device *hbus, struct hv_pci_dev *hpdev; struct pci_child_message *res_req; struct q_res_req_compl comp_pkt; - union { - struct pci_packet init_packet; - u8 buffer[0x100]; + struct { + struct pci_packet init_packet; + u8 buffer[sizeof(struct pci_child_message)]; } pkt; unsigned long flags; int ret;