From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web11.1310.1616123230920512923 for ; Thu, 18 Mar 2021 20:07:12 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=nmUPxVQE; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: zhichao.gao@intel.com) IronPort-SDR: VrgIF/Oor/1LR27E/c7LoJBz2u7vXhr3Qq89lDbcdYlBi9c4PvYzwxWD/vW/aGHXQbENCjeOF0 eDlR/CrEZgfA== X-IronPort-AV: E=McAfee;i="6000,8403,9927"; a="177403995" X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="177403995" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 20:07:03 -0700 IronPort-SDR: iiafbMKI+ubmtsKlPU2nLccEL/MZcCkdzlKTQkpczNYPWMV4sLugVFKwx7U/9PUFuQaEYpqMjn 4/bJ8c3Q4hxA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="606442852" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga005.fm.intel.com with ESMTP; 18 Mar 2021 20:07:02 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 18 Mar 2021 20:07:02 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Thu, 18 Mar 2021 20:07:02 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.171) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Thu, 18 Mar 2021 20:07:02 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rg29Z0+13GWqcMxLwMRLpgvLsY97cxl362Ol8dW+yl61o/IAKLbe2RyBQMg7RdIltrsJm3JdjtmX/omd3YfAT4lWmRCCa+o+8rtHZZHBUJB8NMfHD2q78kWmpoQT9dYl15ZOQbAtiteOl+my00mZLRtOqehC5FtcqNEmmwHQ/i8eXCotjltzY6KmmQ6tWNkcIYRNHvynnsOgOTdyXbMu8LJk3Y0uDTd2Pqd8MU6dQpKXN1jtcyKBbDngXz3YeE78EW29NYfbf0+CRD2qE6f7OZhGDqdZ4z5Kg+PcDHbaleyNGPOUF+S5nOmr7angCQ1j4sBiNljWTzeRtzlCJIlRrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=El4K4iv7UV54Qvm2EwPnLXtPRwLmThX0Sl8cVp0m06A=; b=Isc4gZAinRt//uJ3g9JE+b3Lp7lWMLdaq1fHNJ2IdcEWJdHr/94ya2wQwUVg/OK2IB0lCUR96hu4aFmGMUSwvXtEaqvykA6vZSdDqlGhvRdBBqvnOx8BAjWBS+W5fJsqKg7bCbEn5H6j0buWSuteEM2KGj5gQ2iSdoQ8e4G0I70b65onyy6AT+TKJkhh/mlIAqYcxXfOcr8wv7BbFuKnfPV9H+CY9lRzF0msVOsbRkJie1EfmuU3LZ7zFfsdhluq7Qo77zwOQgXNXS5KPj3eE+jHg3TAV8NuU4oP3Slf6L+UYxnqVXYuOJiy2gd/sMvq4JjcjV3V1O6n+l9TX1vN7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=El4K4iv7UV54Qvm2EwPnLXtPRwLmThX0Sl8cVp0m06A=; b=nmUPxVQE9wbjHucL4ic7eO6EQH0u70PdbJmj/pJRp00XBoYx9OkYebPcs/m7+zIn0b/ev2shVfEBjkrW0tQppbfgEgD6YQ6iRjs0NvfwSyKmR3UU6SIgM65s7dE+8257pU9rT1EywhAqrTrjq/4b2QB2nByCOAhe5/KTD6yNBys= Received: from MWHPR11MB1647.namprd11.prod.outlook.com (2603:10b6:301:d::12) by MW3PR11MB4668.namprd11.prod.outlook.com (2603:10b6:303:54::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Fri, 19 Mar 2021 03:07:01 +0000 Received: from MWHPR11MB1647.namprd11.prod.outlook.com ([fe80::61a2:3dbd:d98b:595c]) by MWHPR11MB1647.namprd11.prod.outlook.com ([fe80::61a2:3dbd:d98b:595c%11]) with mapi id 15.20.3955.018; Fri, 19 Mar 2021 03:07:01 +0000 From: "Gao, Zhichao" To: "devel@edk2.groups.io" , "Kuo, IanX" CC: "Ke, VincentX" , Laszlo Ersek , "Ni, Ray" Subject: Re: [edk2-devel] [PATCH v4] ShellPkg/Pci: Add valid check for PCI extended config space parser Thread-Topic: [edk2-devel] [PATCH v4] ShellPkg/Pci: Add valid check for PCI extended config space parser Thread-Index: AQHXG6Yim/uGaNA5bkmPvxqpi1bnIaqKoPGQ Date: Fri, 19 Mar 2021 03:07:00 +0000 Message-ID: References: <4f96766095369b1062be5ddae93208ac16ca958b.1616036135.git.vincentx.ke@intel.com> In-Reply-To: <4f96766095369b1062be5ddae93208ac16ca958b.1616036135.git.vincentx.ke@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.213] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 036b1da4-2b77-40f9-e318-08d8ea8410ca x-ms-traffictypediagnostic: MW3PR11MB4668: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:257; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3oHPOoJ6CyxIoPM6VJqY1cb8QM87/sn/C80lY387l4He5ppNVo9qiTsPZ8XJRHkHGmQfI4ZdMeio9K9OnKe70vRS5jz0gIiE8m4oNEitlLIxTvlo1VlJBWQ3pYfCmR2Fu0dbBNZT0OXhyqqOyT1rlPpswXRlxP41VMN8gzMRGxJKr98Rm3B+MUBsbSNebotGEPGl95ajIeOWvh7S4gT6sshK/Xk/+YnyKDggiIB19rW0E2Tarq2a6uAYLpwF5HgDYmXlXtfVClKoDQOfCMW7nMud5h+vl2xqaX/sHiYrvIunf7ep8iUy1N6gsb+cxL31ihhLKP5H6Vva68Zko0fzWsgMTD9KQ+e8p8EmZEfxTL1VsWr9f4YDf0p4mcb/w/rnmcI5rqyGswpkGwkRXEGifmcrMzjBJDnaahOXhftM79yuhmFGRZBjUShfpDwZwBQlgamHdokGxqZNsOcAXCSzuGjfYPQ5tzS3rIGn/XzZM/qkn2ZTdDa95VmivzAw3qvHFEw4+bJ6Rce4bUVk/c+OrMRqgYvR56NK0FikQ/6Zgv1rjDz3xFQ/FKThWDp8x+Nutm80rMAZQ5ow+mNo60s7aDRXhC0wCMa3EhAweG7ql9qUlZueZY2mV/i5wrK6PeCDBR2qsmb2QzI73rN/+p/OPApeOiLGr7ILRBBHXw/9/O8LXjDAlHoSrsfL5ru5SGbXKRkyI1hQ3WUcfdLBB9OkPOLHCpXCG1YryVscBJw2JxW4SMD2JYXb+80skRST3crKBbw+CPlXfPNyVtv9MH+w+A== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1647.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(136003)(39860400002)(366004)(396003)(346002)(376002)(76116006)(66946007)(66476007)(64756008)(8936002)(66446008)(66556008)(6636002)(478600001)(316002)(110136005)(54906003)(9686003)(186003)(4326008)(38100700001)(2906002)(55016002)(86362001)(6506007)(5660300002)(83380400001)(52536014)(8676002)(19627235002)(71200400001)(26005)(7696005)(966005)(33656002)(107886003)(53546011)(21314003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?2Pg8QcdAuAT31waLamdQt02Es0xOKBzMHj4guda2tpnFFXjtk/UDcfZP/xdQ?= =?us-ascii?Q?sQerS/jOHsMepds/kuCjZwzACwmzfb4VqqGLt6kQWojlA7whT4B4uDVAmfH1?= =?us-ascii?Q?llCPmtsQVcdsNLJI2grYLblG5P/TdmioMlsilwb6CfYocOkHmgQyVoNXLm7T?= =?us-ascii?Q?OoK46vP+kJY8nIiX9IU44+aMUyNWb6TNSEcQLzViFaigkYTpiZHE73Xb6Ji5?= =?us-ascii?Q?ooZYGwQT+sUTUaXnRtXyTr9/zDQwhGdNiOe/eTuVtDYAPQFawKuuavY2G5Yi?= =?us-ascii?Q?yLiII45yga4SQuK3DcuCpYq4cee9qh/tug2oSmwGVfurfeWJsI4pyUxA/stf?= =?us-ascii?Q?hYmzjCYxOPEyVEkJ3/6hfLnPNfq4ds927YRnHFpByb+EEaWeH+hSvu/zHLxz?= =?us-ascii?Q?lS9mXlVmtWjPLH3IKNlvOKxSU9DhwinzDrnwzuwl3tDvIbuLX8FmwltT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ME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1647.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 036b1da4-2b77-40f9-e318-08d8ea8410ca X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2021 03:07:00.9340 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: nTdSM+TtPRil0YKzNZoklaQ5lZgr1ACtyisbO+JgYZxvHkgzGOhPkQgbo9URgSBQOR8Z+OoDdab0Rhcuwimvzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4668 Return-Path: zhichao.gao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Ian/Vincent, It is better to add the reviewers/maintainers in the CC list. And also add = the one who already give the comment. You can do this with 'git send-email -cc xxx.com' or add Cc: Name in the commit message. Reviewed-by: Zhichao Gao Thanks, Zhichao > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of IanX > Kuo > Sent: Thursday, March 18, 2021 12:02 AM > To: devel@edk2.groups.io > Cc: Ke, VincentX > Subject: [edk2-devel] [PATCH v4] ShellPkg/Pci: Add valid check for PCI > extended config space parser >=20 > From: VincentX Ke >=20 > Bugzilla: 3262 (https://bugzilla.tianocore.org/show_bug.cgi?id=3D3262) >=20 > No need to print PCIe details while CapabilityId is 0xFFFF. > Limit the NextCapabilityOffset to PCI/PCIe configuration space. >=20 > Signed-off-by: VincentX Ke > --- > ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) >=20 > diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c > b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c > index a2f04d8db5..1e5dc75e27 100644 > --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c > +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c > @@ -2038,12 +2038,14 @@ LocatePciCapability ( > @param[in] PciExpressCap PCI Express capability buffer. @para= m[in] > ExtendedConfigSpace PCI Express extended configuration space.+ > @param[in] ExtendedConfigSize PCI Express extended configuration size. > @param[in] ExtendedCapability PCI Express extended capability ID to > explain. **/ VOID PciExplainPciExpress ( IN PCI_CAPABILITY_PCIEXP > *PciExpressCap, IN UINT8 *ExtendedCon= figSpace,+ IN > UINTN ExtendedConfigSize, IN CONST UIN= T16 > ExtendedCapability ); @@ -2921,6 +2923,7 @@ ShellCommandRunPci ( > PciExplainPciExpress ( (PCI_CAPABILITY_PCIEXP *) ((UIN= T8 *) > &ConfigSpace + PcieCapabilityPtr), ExtendedConfigSpace,+ > ExtendedConfigSize, ExtendedCapability ); }@@ -= 5698,12 > +5701,14 @@ PrintPciExtendedCapabilityDetails( > @param[in] PciExpressCap PCI Express capability buffer. @para= m[in] > ExtendedConfigSpace PCI Express extended configuration space.+ > @param[in] ExtendedConfigSize PCI Express extended configuration size. > @param[in] ExtendedCapability PCI Express extended capability ID to > explain. **/ VOID PciExplainPciExpress ( IN PCI_CAPABILITY_PCIEXP > *PciExpressCap, IN UINT8 *ExtendedCon= figSpace,+ IN > UINTN ExtendedConfigSize, IN CONST UIN= T16 > ExtendedCapability ) {@@ -5786,7 +5791,7 @@ PciExplainPciExpress ( > } ExtHdr =3D (PCI_EXP_EXT_HDR*)ExtendedConfigSpace;- while (ExtHdr= - > >CapabilityId !=3D 0 && ExtHdr->CapabilityVersion !=3D 0) {+ while (ExtH= dr- > >CapabilityId !=3D 0 && ExtHdr->CapabilityVersion !=3D 0 && ExtHdr- > >CapabilityId !=3D 0xFFFF) { // // Process this item //@@ -58= 00,7 +5805,8 > @@ PciExplainPciExpress ( > // // Advance to the next item if it exists //- if (ExtHd= r- > >NextCapabilityOffset !=3D 0) {+ if (ExtHdr->NextCapabilityOffset !=3D= 0 &&+ > (ExtHdr->NextCapabilityOffset <=3D (UINT32) (ExtendedConfigSize + > EFI_PCIE_CAPABILITY_BASE_OFFSET - sizeof (PCI_EXP_EXT_HDR)))) > { ExtHdr =3D (PCI_EXP_EXT_HDR*)(ExtendedConfigSpace + ExtHdr- > >NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET); } else > { break;-- > 2.18.0.windows.1 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#72997): https://edk2.groups.io/g/devel/message/72997 > Mute This Topic: https://groups.io/mt/81421888/1768756 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [zhichao.gao@intel.com] > -=3D-=3D-=3D-=3D-=3D-=3D >=20