From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web08.1901.1662733512438360294 for ; Fri, 09 Sep 2022 07:25:12 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ds25VdqO; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: isaac.w.oram@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662733512; x=1694269512; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ffYKHIR3tT09g+nSmX/Qk3laG3TInyVSJ26DNbvupNc=; b=ds25VdqOAbj+6zS2dFLKHZ1ysjWtOMWPJtvphsxN5GiY6NNKtYPpWUBo 4kKHFtGZhCOKfBDf0brBuYiMTBMG0CTYWgyuZF6rj1BlqzxGMbVEKSicl uPpnoSZynZ0zy3u/n5D72ehPLNotwBQnh0Qa5UqeXNkUosYTTJ4mG609I U1Bv99/Q/YK9ZSidG1bycRULlqZPiieJHAOGxsOgR9VHTmb/9Qo3vEkNp Hg121ItCKLZQk1FTLLk85FJidtw7H27G+J8V6bE2ZcBciZUTQFEBV6Hk0 5MkfUrjuKRbw0/whplpWy4qqloUAJVTTDZMykDkHpMaEKYY2XVpUVZCBW A==; X-IronPort-AV: E=McAfee;i="6500,9779,10465"; a="323694431" X-IronPort-AV: E=Sophos;i="5.93,303,1654585200"; d="scan'208";a="323694431" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Sep 2022 07:25:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,303,1654585200"; d="scan'208";a="741063311" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga004.jf.intel.com with ESMTP; 09 Sep 2022 07:25:09 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 9 Sep 2022 07:25:09 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Fri, 9 Sep 2022 07:25:09 -0700 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.170) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Fri, 9 Sep 2022 07:25:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XM08BbIHHcqX/dhKI0w/uIyd4bKOMzdY4AqHtBNtGGTon4s8vm5k/AImZaRZcmfLHetTbwdVTdECtWvgBXrtrlA5xxfU0Lsr7O+IVzOkLux/s+1fQwQP4p7SCqrAwkp+Qp92lJo2H+4SlAX6CdJ3JhnQx6GPMSsGl9CjHoq4eF7+GBZFyrLoGlxEaGayipOC6yocfXVxXWA0LKv9wXqj1hGu94zbe7M9efa6C+RdoUT+IzG+RPRrI0uSSme+aYKZNtRA0a5/4nFYlctcMjHubgOulJ5Ic+Es0VgyPGKBMa8v1dd/hfcRNpG0mVqtnNzlsIboPKeQpbXHvCCMM12rAQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=T0wAGDGPCWz8W8gdjvm4gx8TfCfTL8NceAiM5htk814=; b=YQAdc2MT1cxeF6j611BIpHJDa8oOTHWnzgTxUdMJZieAD4iw6C41JCa+w3hbBoGjW9fMNmEVkAkyMIbdcM2NYSmIP44SOi9BqC+A1b7l1nnPOZjvlFo06rnRzQBXJhYOs/XDGcFtm0HMVe+TiUBlVBzKdugcfv/vC7tnT05bPIFqUOXx7jxrhz7zN3RrjAU5cW7zjgVunjJg07f48vgh6aIvE/gSwGEg1PyQOeK0SmZmb1EAfu+OqTZ5yzwHw/9Bx1XCvc2Y5m+mG3qK8cL9rd8mD3jOJiQnQtvZ+38yMdUltuVCGm1+zKDz2eiwrKnSjnwNaCgL9rqLKkssIHFz1A== 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 Received: from SA1PR11MB5801.namprd11.prod.outlook.com (2603:10b6:806:23d::13) by DM4PR11MB5503.namprd11.prod.outlook.com (2603:10b6:5:39f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.19; Fri, 9 Sep 2022 14:24:52 +0000 Received: from SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::4149:e96e:480e:e1c3]) by SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::4149:e96e:480e:e1c3%5]) with mapi id 15.20.5588.010; Fri, 9 Sep 2022 14:24:52 +0000 From: "Isaac Oram" To: "mikuback@linux.microsoft.com" , "devel@edk2.groups.io" CC: "Chiu, Chasel" , "Desimone, Nathaniel L" , "Gao, Liming" , "Dong, Eric" Subject: Re: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix out of bounds array index access Thread-Topic: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix out of bounds array index access Thread-Index: AQHYxFRevRuFrd6f4ke1eUw/DM4GUq3XJxFQ Date: Fri, 9 Sep 2022 14:24:52 +0000 Message-ID: References: <20220909135843.659-1-mikuback@linux.microsoft.com> In-Reply-To: <20220909135843.659-1-mikuback@linux.microsoft.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fde3ac61-f4da-4210-979a-08da926f0f94 x-ms-traffictypediagnostic: DM4PR11MB5503:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2k4J3nZ8VohBXX8tzQehMcbXr4xPIsNMcTjbBVf0r1NkY2kNw0a8AQIRQytuDCrYm/kWYpE0MW/G6ctUMx873N5f6oHpdPyyoZTgXj26bRNxIPNCcqPOyTWsJRVUvN2jyxaekrt8FRFeJbNtQ6Q5xZParXEINtuGdy62vTTCx4HkapYCFzCsAwyG6nPdl+7mwDVZelTX9VcZmUEfgQYwtPOYKLfdQvXs4ATWeKF/kkvb7qFJcpiOJomui+RppUraG+vD35LBSn9iNfU2Yw6RyRJ7h5V2NSbUxNh3ni38Ahko4GX1JHcmB2V/gD3zOaiReoxOO8K8jp/0cT5Ms6KgUQtC56DIO8U8v3pBeZyyXpZG6oQ2z+fUaQ7dolkfPlYQzdz8kS4kiyW4AqxeRNuEyON6nZI42qwYjJS8CVmFh6XJ1MhUtxEse8vUjPK9cZaGLcGGDmRNBiZxhs7bEhC4E1VZ7VFVAYCCwk5XTf31YWAyZRxFMvUI/oHpSf0xJh2QSmaJ4q4RnWoSOpzy2iZo9Kbeuh8lh/ZHZVgfMAJyzjLLLIRZRom5LqPkqdIqBCCvXENyLVVUqMTnF3gddUgaR19awSDh5yl6aDDyTHxbTrtdiYx+zE0VezXatpDEnIzsJUs+Gr5lAwkzlOvSj1H2FxNu6Lz1AKs1P7GpvWCPuhBotyBrFbZvwYG7VJezo6E0O7Cf0KGOPz1UMxtTyQbhPtnFvVzzfbNa8Aho/tsrcTiqudzcknBPxWjHHv595teLmTGfgrxOMmVSsiipJfGQXQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR11MB5801.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(366004)(39860400002)(346002)(376002)(396003)(5660300002)(2906002)(53546011)(186003)(6506007)(9686003)(82960400001)(26005)(122000001)(7696005)(33656002)(38070700005)(316002)(86362001)(8676002)(54906003)(66476007)(66946007)(66446008)(76116006)(64756008)(478600001)(66556008)(4326008)(110136005)(52536014)(55016003)(8936002)(83380400001)(71200400001)(38100700002)(41300700001)(107886003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?QUPTgc0tVU3wK5JoT88H7QoMDLcFDohQgWICV0wPKMr3cOzrRFX5Tv+BpoR6?= =?us-ascii?Q?s6aC3isIQEmvfn8C5olEJGhWuVjfohSRy9pBHC0FBcZCLtfP3EVJ9Ua0sNRi?= =?us-ascii?Q?LK0qqJAmXNxVJKcRH2c55+X0zdBAUK/DPldftMwYLbPlt+LHTFO3NpZi84It?= =?us-ascii?Q?cGbnc5ScPed8UpXQCSGiUPHPdT+NBB61te1BkVAGtWZtuYmzO8DB+LiIWcN6?= =?us-ascii?Q?kOSDO8kp527MxuQtnQKPJVhg2xZDNS572/Kq2bfPrTOmWI+JVOuUbosYGqLp?= =?us-ascii?Q?07x0QMzg7zfFuH4JFEo3pMYhy0K5xPEwqSUDDom3CGL124BcZP0mJZa3ZeCT?= =?us-ascii?Q?iTQR5lZBnJDJZ4yhpfb2lDlOx05X1i2ooFVmVsRAOvmeGxVHiiktHqGIoi5p?= =?us-ascii?Q?v0AhAGTzjUT0YkyWu7BfVLHfRpZhbaGl53Miiw317E3J1sSZz+CoeX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iBUHooCMew9IJASHYJTnRZd0ZwlDSJhxI8z?= =?us-ascii?Q?tzawpg6GhFZLyoU1v5THPXR/OOqDATVpgLUFwVmxAvBGLRdUL7D5XyISZgGe?= =?us-ascii?Q?ZIFpJf8Q2UZRhsHH04hc58vvULm00lzCAqKjX9IYZ7MZWDSw+5VBUwYi+8KP?= =?us-ascii?Q?7h5IgofTN5FVs7jpuWbcrT+KJjWIfm1EIbfoscJdFCt1BkohWRWNWAaBDULL?= =?us-ascii?Q?lPyXg3fAcE2hR3SqAbnhKXBkG/9IY+EJyEJfaZ2N?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA1PR11MB5801.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fde3ac61-f4da-4210-979a-08da926f0f94 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Sep 2022 14:24:52.6299 (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: k+2y7bYmhs3JHtMI+sPsWSyO3xnsTqm2P6XElnd4MKroPY/CXEfU5QieSZWEfXFunlXXPYFv5pXh6lTZuiuo7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5503 Return-Path: isaac.w.oram@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Isaac Oram -----Original Message----- From: mikuback@linux.microsoft.com =20 Sent: Friday, September 9, 2022 6:59 AM To: devel@edk2.groups.io Cc: Chiu, Chasel ; Desimone, Nathaniel L ; Oram, Isaac W ; Gao, Liming = ; Dong, Eric Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: F= ix out of bounds array index access From: Michael Kubacki The following code accesses array index "6" which is invalid as the array i= s of length 6. DEBUG ((DEBUG_INFO, " %08x %08x %08x %08x %08x %08x", PciData->Device.Bar[0], PciData->Device.Bar[1], PciData->Device.Bar[2], PciData->Device.Bar[3], PciData->Device.Bar[4], PciData->Device.Bar[6] <-- BAD ARRAY INDEX )); PciData is of type "PCI_TYPE00": typedef struct { PCI_DEVICE_INDEPENDENT_REGION Hdr; PCI_DEVICE_HEADER_TYPE_REGION Device; } PCI_TYPE00; "PCI_DEVICE_HEADER_TYPE_REGION": typedef struct { UINT32 Bar[6]; <- NOTE: ARRAY LENGTH IS 6 UINT32 CISPtr; UINT16 SubsystemVendorID; UINT16 SubsystemID; UINT32 ExpansionRomBar; UINT8 CapabilityPtr; UINT8 Reserved1[3]; UINT32 Reserved2; UINT8 InterruptLine; UINT8 InterruptPin; UINT8 MinGnt; UINT8 MaxLat; } PCI_DEVICE_HEADER_TYPE_REGION; This change fixes the array index value. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Isaac Oram Cc: Liming Gao Cc: Eric Dong Signed-off-by: Michael Kubacki --- Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckPci.c= | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeCheckPci.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib= /DxeCheckPci.c index 514003944758..575284ccc727 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= Pci.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh +++ eckPci.c @@ -75,7 +75,7 @@ DumpPciDevice ( PciData->Device.Bar[2], PciData->Device.Bar[3], PciData->Device.Bar[4], - PciData->Device.Bar[6] + PciData->Device.Bar[5] )); DEBUG ((DEBUG_INFO, " %04x\n", PciData->Hdr.Command @@ -256,7 +256,7 @@ TestPointCheckPciResource ( UINT16 MinBus; UINT16 MaxBus; BOOLEAN IsEnd; - =20 + DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointCheckPciResource - Enter\n"))= ; HandleBuf =3D NULL; Status =3D gBS->LocateHandleBuffer ( @@ -338,7 +338,7 @@ TestPointCheckPciResource ( // Device DumpPciDevice ((UINT8)Bus, (UINT8)Device, (UINT8)Func, &Pc= iData); } - =20 + // // If this is not a multi-function device, we can leave the = loop // to deal with the next device. @@ -360,7 +360,7 @@ TestPointCheckPciResource ( } } } - =20 + Done: if (HandleBuf !=3D NULL) { FreePool (HandleBuf); -- 2.28.0.windows.1