From patchwork Sat Sep 6 03:19:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirsher, Jeffrey T" X-Patchwork-Id: 4856931 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 20E35C0338 for ; Sat, 6 Sep 2014 03:19:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5BE8C20260 for ; Sat, 6 Sep 2014 03:19:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E2022025A for ; Sat, 6 Sep 2014 03:19:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751120AbaIFDTP (ORCPT ); Fri, 5 Sep 2014 23:19:15 -0400 Received: from mga01.intel.com ([192.55.52.88]:36217 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751023AbaIFDTO (ORCPT ); Fri, 5 Sep 2014 23:19:14 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 05 Sep 2014 20:19:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,477,1406617200"; d="scan'208";a="587103953" Received: from srsastry-mobl1.amr.corp.intel.com (HELO jtkirshe-mobl.amr.corp.intel.com) ([10.254.114.17]) by fmsmga001.fm.intel.com with ESMTP; 05 Sep 2014 20:19:13 -0700 From: Jeff Kirsher To: bhelgaas@google.com Cc: Megan Kamiya , linux-pci@vger.kernel.org, Jeff Kirsher Subject: [PATCH] pci: Parenthesize parameters in PCI_DEVID and PCI_VPD_LRDT_ID macros Date: Fri, 5 Sep 2014 20:19:10 -0700 Message-Id: <1409973550-29434-1-git-send-email-jeffrey.t.kirsher@intel.com> X-Mailer: git-send-email 1.9.3 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Megan Kamiya Add parentheses around parameters in PCI_DEVID and PCI_VPD_LRDT_ID macros to prevent possible expansion errors as described by the CERT Secure Coding Standard: PRE01-C: Use parentheses within macros around parameter names Signed-off-by: Megan Kamiya Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher --- include/linux/pci.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/pci.h b/include/linux/pci.h index 61978a4..cb744f3 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -45,7 +45,7 @@ * In the interest of not exposing interfaces to user-space unnecessarily, * the following kernel-only defines are being added here. */ -#define PCI_DEVID(bus, devfn) ((((u16)bus) << 8) | devfn) +#define PCI_DEVID(bus, devfn) ((((u16)(bus)) << 8) | (devfn)) /* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */ #define PCI_BUS_NUM(x) (((x) >> 8) & 0xff) @@ -1701,7 +1701,7 @@ bool pci_acs_path_enabled(struct pci_dev *start, struct pci_dev *end, u16 acs_flags); #define PCI_VPD_LRDT 0x80 /* Large Resource Data Type */ -#define PCI_VPD_LRDT_ID(x) (x | PCI_VPD_LRDT) +#define PCI_VPD_LRDT_ID(x) ((x) | PCI_VPD_LRDT) /* Large Resource Data Type Tag Item Names */ #define PCI_VPD_LTIN_ID_STRING 0x02 /* Identifier String */