From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web08.357.1659719753307751165 for ; Fri, 05 Aug 2022 10:15:53 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=q6+oT/YC; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from localhost.localdomain (unknown [47.195.228.134]) by linux.microsoft.com (Postfix) with ESMTPSA id 0447F20FFE34; Fri, 5 Aug 2022 10:15:51 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0447F20FFE34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1659719752; bh=gz1xhHaivPdCz8rbp1uvAt1YVeAWm5qIov7IcuuUCwM=; h=From:To:Cc:Subject:Date:From; b=q6+oT/YCk88IOdbhqu3FRb/njuLNeULFmhlnLBw3ZgKtqaHR8Hxxrmr9c/pgLZ7hu qPhdBui//4OinL1s2YKuTdjT0NmTsmdybEykN5BQY8KBWj6/VSpxVz/sPKX8xBblTB 2oXszvj2/3DiKQzefPAkYHg11QHUISKj9Zdwr3gU= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Isaac Oram , Liming Gao , Eric Dong Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Prevent modification of HOB data Date: Fri, 5 Aug 2022 13:15:32 -0400 Message-Id: <20220805171532.868-1-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.28.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Kubacki DumpMemoryTypeInfoSummary() is used to dump information about the MemoryTypeInformation HOB. The dump function currently modifies the data which can corrupt the data for later HOB consumers in the DXE phase. This change makes DumpMemoryTypeInfoSummary() treat the data as read-only. 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/DxeCheckMem= oryTypeInformation.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib= /DxeCheckMemoryTypeInformation.c b/Platform/Intel/MinPlatformPkg/Test/Lib= rary/TestPointCheckLib/DxeCheckMemoryTypeInformation.c index 9ee9dd252c7e..a30b69dd787c 100644 --- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChe= ckMemoryTypeInformation.c +++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeChe= ckMemoryTypeInformation.c @@ -22,8 +22,8 @@ ShortNameOfMemoryType( =20 VOID DumpMemoryTypeInfoSummary ( - IN EFI_MEMORY_TYPE_INFORMATION *CurrentMemoryTypeInformation, - IN EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation + IN CONST EFI_MEMORY_TYPE_INFORMATION *CurrentMemoryTypeInformation, + IN CONST EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation ) { UINTN Index; @@ -83,7 +83,6 @@ DumpMemoryTypeInfoSummary ( } =20 if (Next !=3D Previous) { - PreviousMemoryTypeInformation[Index].NumberOfPages =3D Next; MemoryTypeInformationModified =3D TRUE; } =20 @@ -110,7 +109,7 @@ TestPointCheckMemoryTypeInformation ( VOID *CurrentMemoryTypeInformation; VOID *PreviousMemoryTypeInformation; VOID *VariableMemoryTypeInformation; - =20 + DEBUG ((DEBUG_INFO, "=3D=3D=3D=3D TestPointCheckMemoryTypeInformation = - Enter\n")); CurrentMemoryTypeInformation =3D NULL; PreviousMemoryTypeInformation =3D NULL; --=20 2.28.0.windows.1