From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web12.19805.1639441339905494578 for ; Mon, 13 Dec 2021 16:22:20 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@intel.com header.s=intel header.b=XmZ8xQf/; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: nathaniel.l.desimone@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639441339; x=1670977339; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=XaWReppob1WxdrPe8LLWXw1MacPmp96jhL1CUxEEIM4=; b=XmZ8xQf/JA+g1LPQem6d3YOFyDcJvpJbBxanN0QZb4a1tLidyIWlW3Wz 2c7QVzi4NbXYgLqSlIdDu5CpMqvdpbJS0vvwZLSNPouiRjbw7xZj94op3 OEVdm6tGAf6sW0ZpKsdazpCq4Z0ufVOz/azlVhqiA9vkFoVaEi+hns2ZI iibTamEJK1ZzezeLXJmcf9EbKjj3MJMxVnCEe6LscjG/MIAlzAPLLPFIM wUGo38nHh6Bh1LU48YqjYbnGW92NmRaezP514EeARycqObSmNmWOMPDZg ogHnOm/pCqdhfb8G2VcKqBWhtd0QEaz3EPpNEHDSDFdpXr3I4l3S9iuVF Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10197"; a="299641749" X-IronPort-AV: E=Sophos;i="5.88,203,1635231600"; d="scan'208";a="299641749" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2021 16:22:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,203,1635231600"; d="scan'208";a="614025751" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga004.jf.intel.com with ESMTP; 13 Dec 2021 16:22:18 -0800 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) 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.2308.20; Mon, 13 Dec 2021 16:22:18 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Mon, 13 Dec 2021 16:22:18 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.171) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Mon, 13 Dec 2021 16:22:18 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VjqyROQwP24aujBIa+7YQXYURYWtKyScsB0H46RnwtQ/QeSKnYLDRPVngytcTlMNSkIuj69NMLIgHBOyA/kLXQ8A2Ydy9YKAqvwGOB0kvHBSVhbgv2ywcVmWQwMzFgnL0qkvOBMGtsIAM4q+rt/KGePZ5ukmjTo9OXR4In6ns5F236fek7i1Rg5jvrG41INKOwpRpTfCMMhteJ4/YV0FA9ybMmQnuJnVnzrYpd7Tgn3poLW9KpW7sMhNfjQN+dl7/xaq55NabSd6IcJDc88Ffqrh9QO6ma6HPTTkAZMwh1VnbTCJQrzr99VdHh3yWuupeYGcAQgPygIBUkfLC1aziw== 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=Cp8pGr1opX3znm9qNkmcYdbitR8DhMH/Uby6q2VNN2I=; b=JBiraE5oqsrag9tKCkMxqA15w4qopZDp2qSa8dd89N3B9XNMUboNWJ3sL5hgaCkr7bJYmpgd6b/jOAFIT7ssT/F63iuST0JCrxivVbobxkU7GcFIkZh9Rr+VO/54H/m5TQQhdhrMJXCMpCWTG5aE1ZaAp2Gf8KBjAc81nAw78gvbOQP31UY7wMCUJZYelHXVOzh5/DbiLyl+eHvxCxLJRFHoXB8k/lUiL5KQeDAxyVZPn1cUnit7w/WevJNJe04Vb2qpcT+sDaTV7ne0/sXx2UqpyU9hhhlDxKt1FeAY42p8VSX3oaF7E/USWKSITwvobg7M5p6CbVtUFUlnxABJ+A== 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=Cp8pGr1opX3znm9qNkmcYdbitR8DhMH/Uby6q2VNN2I=; b=VsMw2sKbFg2RqmeWrv4IWecEmZ4AALpyh5oQo/9HLe9lo+9HptDYs9Ie52RCGrsCgC+V2EFvpsJVZr0pBHqizu7vu1yBhd1bc1n/vXGF4YFOvsCgj9iYtR80mnzs60IXzkxA34+8tNc50/HWyKDMUwF+0CcdMmHRCOqcqkkyuAA= Received: from MW4PR11MB5821.namprd11.prod.outlook.com (2603:10b6:303:184::5) by MWHPR11MB1598.namprd11.prod.outlook.com (2603:10b6:301:c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.14; Tue, 14 Dec 2021 00:22:17 +0000 Received: from MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::6920:39b9:e18c:9dc5]) by MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::6920:39b9:e18c:9dc5%8]) with mapi id 15.20.4778.017; Tue, 14 Dec 2021 00:22:17 +0000 From: "Nate DeSimone" To: "mikuback@linux.microsoft.com" , "devel@edk2.groups.io" CC: "Chiu, Chasel" , "Gao, Liming" , "Dong, Eric" Subject: Re: [edk2-platforms][PATCH v2 1/1] MinPlatformPkg/TestPointCheckLib: Fix DMAR structure length calculation Thread-Topic: [edk2-platforms][PATCH v2 1/1] MinPlatformPkg/TestPointCheckLib: Fix DMAR structure length calculation Thread-Index: AQHX7iVBrmJuxvZxUE20CY2q8waO9KwxJOgg Date: Tue, 14 Dec 2021 00:22:17 +0000 Message-ID: References: <20211211002216.4464-1-mikuback@linux.microsoft.com> In-Reply-To: <20211211002216.4464-1-mikuback@linux.microsoft.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.200.16 dlp-product: dlpe-windows 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: ae3b9896-330a-4143-47ac-08d9be97c919 x-ms-traffictypediagnostic: MWHPR11MB1598:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: M4BYjwzUqp3pumsbbUMLV1/g85ocfPrB8uAfuanH9VxCX3R8Dmg2LS0iyg6yOlaChpRDzM8UxBAyrcQyIuVckcgedoOKKYv8XfALeDCnpPHOicN/hQF5Qr1cQwZgegVSia4PXkSi15PYaV4Vau52KhKn0tAfzx5/vZ3WmM5ZnvQAXN73hl/74U2KJJWiRtOG9Odbdkwswa1m6aqD3aHQt4u7L/0TIJl8timlg1QA+9cYUX7h5INYxjVYU1evZ2xj0X6Nh7Jl8U9FdyfISjTwl2eTu9k6WzyAsOWNkkssDmKF0LShRY7Co5hI2k8/NhdH2trzEZGWNHuyY4aL1Js9RuMSY2b4qCWDxiTingpr3MzdeloAgF2oDsgTexn+kvJ9gqMUbyM22RzuZoRQtkaHGWIjzFgv91kRTlue6O/hlt294fW2TQFYl9O5boiTu3AQ8dFd2f+F6vzo+RRkDgiJkA/AM1OdWj4Rug1hX0goQTEjo4CAM4sWICHK6J+pEk9rmbDgIhnfDcjeYowGHf6gDJmu6DV2oSN2JOm5+0QZTgOyFYG/u0XUzy+LJ3/Pv6qQWhxGAXY30JHBAOeh8qmCpRmsVI0M+zvCmptknEqjzlfBmgm2fJIDVOXKnBsHzgqrKlK6LsXtZNZTRFO/EVXsMHMq23cUwxJs7MgcRH0X+CfCz+w3sjPkvF8vF/DzHvrr49eSNr4dfN0icMKfkN1/b/8BQHEzt8n6Du1sAEt80xWFhAmMHQbfxDlMEGa7qh+bALPvGbgJiGF3gvBpgmoBxP8C142tMDK1MqWOPKQyMe0= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR11MB5821.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(82960400001)(8936002)(122000001)(26005)(107886003)(38070700005)(186003)(5660300002)(508600001)(55016003)(33656002)(83380400001)(8676002)(54906003)(2906002)(71200400001)(316002)(53546011)(9686003)(6506007)(4326008)(110136005)(66446008)(52536014)(64756008)(66476007)(7696005)(66556008)(38100700002)(66946007)(76116006)(86362001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ZB+kkSk2mW9rNupSed86V2ywd9tmJiuHXMTbgW9sPcuRdQjq/Ogjw/YYm2Kc?= =?us-ascii?Q?zGyKZNJ0gMk0xlquISS+Qk3dC0TYJYW4K9yuocWthPLPf+9xSULStXHp1g/k?= =?us-ascii?Q?u1F3fnSiozrBhO69OTJu5twOWmZUTu9eWxgcjHjYc9DJOP2buFQQnGRA50Cf?= =?us-ascii?Q?ChJwnnOvFyb0P7DmiVcc1cQT/v/Xu90SsocyrrMbCcoC8uqT5yYaB7b2f9q7?= =?us-ascii?Q?92u87ufccMtqNcxQVjWgPL4BsTf/EAoSYlPJ2bYYK29sJ8VOrFbN1eRwrfsv?= =?us-ascii?Q?VCkj2dHCe32WKVBURopNPI1of1lmQEpzM95kTgONIxLiH9RioNkw9e1QOWnq?= =?us-ascii?Q?4kwVoe1UkZRCYZmqdJhRQas0n4rs3P6/yFn4p10APR3GMaTUG0aynFNBATtJ?= =?us-ascii?Q?K+5qzDnon8Vdn3ndy8DIzgH3cTCpYuhJ+mvbJjA2/b01CSqOv1T+dp/RuShK?= =?us-ascii?Q?YT9n7aeQNv6azRLaDQ8mabWUnOqY9npqvpbM2GsfH2xWsQyU+btAvNq2Z2/m?= =?us-ascii?Q?nqH4d26/d37bKgl3Sj9YiXkjcS64kQ0WnWaRlHNMtcRQCDU6yHV4fGj+btJs?= =?us-ascii?Q?IXRUmBYXdC8ZazMUdArngx5+szTemGwlf1Nq+Hak7YadmgWOZ/3B3bFNFHhI?= =?us-ascii?Q?aBMmDLTonG7+InAuiapcvFaD2LAhiJISdniwuOA500seCa646I0u/LF3ch1C?= =?us-ascii?Q?+j6AkQlass5TI2zrZ0z+FHZscj/rExis14vtKNplEbICgETiA//2M6kQoZu/?= =?us-ascii?Q?nvkWN0CZdycfz//kwig3KmNS68deIFTInMPQq8Eg1bnJxSwiMtd+lqa036Pv?= =?us-ascii?Q?wWE36yKwfmPgl8/boUNREfbfYBR4mSSbeX85n1qwerjeq14RmtTomprp6A2R?= =?us-ascii?Q?xw8YCM/jO86B6aH7lGyaZhMyScv4bnaWJtGFBLx4ItHFZTxDuwqmC3QmBn8g?= =?us-ascii?Q?ivTSyXlFSy6iUAjafPGIF280IXTRWhsOqnz8ykpgyqtJSgzyXrxuH2X322EG?= =?us-ascii?Q?BEvfEAS1WpmtG9iio3nSQ1U6qy0fxVlgV/9hUSgKlZ9pm+/yPEx3zLQYVjVn?= =?us-ascii?Q?2zIdtpKYCi0+IgU6l0CvSu/8I0+hKOqGRnuCtG5MXNySrRQEJrRwsEUSBRai?= =?us-ascii?Q?ZhOjLjLmfXYX2Qp2r1X2PGF7cx31PzZ25W2ogoV/AgxHP8RvcwmOzPDra9VO?= =?us-ascii?Q?teH7E6VhtRFGPRZR9TyJYWwciVgH517PtgYpROLacPVFWcyj/6euyqP+DZkv?= =?us-ascii?Q?0y8rqaQIEgQ+EDIMBGp6pRYuqLWu6EEDsrxjQeXszHnsgcgC8iew6/mT0jze?= =?us-ascii?Q?B1OFqaFbDj0uyW3Q2P1c47isCYE3UV6FdC84bPuLynKyj5VohV86RRiEL7Yc?= =?us-ascii?Q?js1myFJ05kevhHlZ3dZCkvppwjIpP3/kFZ+KqFMnZzWe0qjbyU7JjMTqM3Q9?= =?us-ascii?Q?B2HTbZfg7stx9fV03Ys84pAzCFf82lpF5SNjPLdjPkwIn1Nva8B8kUn+XJwj?= =?us-ascii?Q?aH9Ki3h/SHxzqSqRBiuj/RsJ4lTnI87rFWmULLi4fwd7ah+xVwW1rd8WFohj?= =?us-ascii?Q?o2lb4/H7EOUsRiB7VDq/d7Em/+GTZgpKM+mhqF1XSbwIakL7c/fZZpG3NHAq?= =?us-ascii?Q?dMNjvKuCYTI2FRkZULrnIOiWM3awmAcaHNEErDzmrl4Fn2/DrMVxFF7S4PzR?= =?us-ascii?Q?35X7RQ=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5821.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae3b9896-330a-4143-47ac-08d9be97c919 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Dec 2021 00:22:17.1589 (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: NkHX3DpHpFUcFawZGtQ0fe12Zk7X7qcYlFKUNgfV6mDklQrpvXDnE3BqYrSTUOTw++VQ7P0l7e4UvMspPixZjTBLi7/1JajHbiNoFOFmNSk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1598 Return-Path: nathaniel.l.desimone@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Nate DeSimone -----Original Message----- From: mikuback@linux.microsoft.com =20 Sent: Friday, December 10, 2021 4:22 PM To: devel@edk2.groups.io Cc: Chiu, Chasel ; Desimone, Nathaniel L ; Liming Gao ; Dong, Eric Subject: [edk2-platforms][PATCH v2 1/1] MinPlatformPkg/TestPointCheckLib: F= ix DMAR structure length calculation From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3768 When processing DMAR structures of type EFI_ACPI_DMAR_STRUCTURE_HEADER within the ACPI DMAR table, the code determi= nes the structure length by subtracting the DMAR structure headers present = from the overall DMAR ACPI table size. The terminating condition is that the remaining total DMAR length is greate= r than zero. However, the current DMAR structure length is subtracted after= the DMAR structure pointer has already been assigned to the next structure= . This change subtracts the current DMAR structure length before transitionin= g to the next structure. The terminating condition is also updated to ensure the remaining size is a= t least as large as the expected structure header size. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: Michael Kubacki --- Notes: V2 Changes: =20 - Updated the terminating condition to ensure the remaining size is at least as large as the expected structure size. Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckAcpiD= mar.c | 8 ++++---- Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckDmaPr= otection.c | 4 ++-- Platform/Intel/MinPlatformPkg/Test/Library/TestPointCh= eckLib/PeiCheckDmaProtection.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeCheckAcpiDmar.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointChe= ckLib/DxeCheckAcpiDmar.c index b2279966d8ed..e0b7aaa48527 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= AcpiDmar.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh +++ eckAcpiDmar.c @@ -133,7 +133,7 @@ DumpAcpiDmar ( // DmarLen =3D Dmar->Header.Length - sizeof(EFI_ACPI_DMAR_HEADER); DmarStructHeader =3D (EFI_ACPI_DMAR_STRUCTURE_HEADER *)(Dmar + 1); - while (DmarLen > 0) { + while (DmarLen >=3D sizeof (*DmarStructHeader)) { switch (DmarStructHeader->Type) { case EFI_ACPI_DMAR_TYPE_DRHD: Drhd =3D (EFI_ACPI_DMAR_DRHD_HEADER *)DmarStructHeader; @@ -204,8 +2= 04,8 @@ DumpAcpiDmar ( DEBUG ((DEBUG_INFO, "\n")); break; } - DmarStructHeader =3D (EFI_ACPI_DMAR_STRUCTURE_HEADER *)((UINT8 *)DmarS= tructHeader + DmarStructHeader->Length); DmarLen -=3D DmarStructHeader->Length; + DmarStructHeader =3D (EFI_ACPI_DMAR_STRUCTURE_HEADER *)((UINT8=20 + *)DmarStructHeader + DmarStructHeader->Length); } } =20 @@ -220,7 +220,7 @@ CheckAcpiDmar ( =20 DmarLen =3D Dmar->Header.Length - sizeof(EFI_ACPI_DMAR_HEADER); DmarStructHeader =3D (EFI_ACPI_DMAR_STRUCTURE_HEADER *)(Dmar + 1); - while (DmarLen > 0) { + while (DmarLen >=3D sizeof (*DmarStructHeader)) { switch (DmarStructHeader->Type) { case EFI_ACPI_DMAR_TYPE_DRHD: Drhd =3D (EFI_ACPI_DMAR_DRHD_HEADER *)DmarStructHeader; @@ -232,8 +2= 32,8 @@ CheckAcpiDmar ( default: break; } - DmarStructHeader =3D (EFI_ACPI_DMAR_STRUCTURE_HEADER *)((UINT8 *)DmarS= tructHeader + DmarStructHeader->Length); DmarLen -=3D DmarStructHeader->Length; + DmarStructHeader =3D (EFI_ACPI_DMAR_STRUCTURE_HEADER *)((UINT8=20 + *)DmarStructHeader + DmarStructHeader->Length); } return EFI_SUCCESS; } \ No newline at end of file diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/D= xeCheckDmaProtection.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPoi= ntCheckLib/DxeCheckDmaProtection.c index 10b44fe8b9b8..aba0985956f2 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheck= DmaProtection.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh +++ eckDmaProtection.c @@ -38,7 +38,7 @@ CheckDrhd ( // DmarLen =3D Dmar->Header.Length - sizeof(EFI_ACPI_DMAR_HEADER); DmarStructHeader =3D (EFI_ACPI_DMAR_STRUCTURE_HEADER *)(Dmar + 1); - while (DmarLen > 0) { + while (DmarLen >=3D sizeof (*DmarStructHeader)) { switch (DmarStructHeader->Type) { case EFI_ACPI_DMAR_TYPE_DRHD: Drhd =3D (EFI_ACPI_DMAR_DRHD_HEADER *)DmarStructHeader; @@ -56,8 +56= ,8 @@ CheckDrhd ( default: break; } - DmarStructHeader =3D (EFI_ACPI_DMAR_STRUCTURE_HEADER *)((UINT8 *)DmarS= tructHeader + DmarStructHeader->Length); DmarLen -=3D DmarStructHeader->Length; + DmarStructHeader =3D (EFI_ACPI_DMAR_STRUCTURE_HEADER *)((UINT8=20 + *)DmarStructHeader + DmarStructHeader->Length); } =20 return EFI_SUCCESS; diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/P= eiCheckDmaProtection.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPoi= ntCheckLib/PeiCheckDmaProtection.c index cb764b3633ef..5a18235eddf4 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/PeiCheck= DmaProtection.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/PeiCh +++ eckDmaProtection.c @@ -36,7 +36,7 @@ CheckDrhd ( // DmarLen =3D Dmar->Header.Length - sizeof(EFI_ACPI_DMAR_HEADER); DmarStructHeader =3D (EFI_ACPI_DMAR_STRUCTURE_HEADER *)(Dmar + 1); - while (DmarLen > 0) { + while (DmarLen >=3D sizeof (*DmarStructHeader)) { switch (DmarStructHeader->Type) { case EFI_ACPI_DMAR_TYPE_DRHD: Drhd =3D (EFI_ACPI_DMAR_DRHD_HEADER *)DmarStructHeader; @@ -61,8 +61= ,8 @@ CheckDrhd ( default: break; } - DmarStructHeader =3D (EFI_ACPI_DMAR_STRUCTURE_HEADER *)((UINT8 *)DmarS= tructHeader + DmarStructHeader->Length); DmarLen -=3D DmarStructHeader->Length; + DmarStructHeader =3D (EFI_ACPI_DMAR_STRUCTURE_HEADER *)((UINT8=20 + *)DmarStructHeader + DmarStructHeader->Length); } =20 return EFI_SUCCESS; -- 2.28.0.windows.1