[edk2-devel] [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Prevent modification of HOB data

Oram, Isaac W isaac.w.oram at intel.com
Fri Aug 5 20:29:57 UTC 2022


Reviewed-by: Isaac Oram <isaac.w.oram at intel.com>

-----Original Message-----
From: mikuback at linux.microsoft.com <mikuback at linux.microsoft.com> 
Sent: Friday, August 5, 2022 10:16 AM
To: devel at edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu at intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone at intel.com>; Oram, Isaac W <isaac.w.oram at intel.com>; Gao, Liming <gaoliming at byosoft.com.cn>; Dong, Eric <eric.dong at intel.com>
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Prevent modification of HOB data

From: Michael Kubacki <michael.kubacki at microsoft.com>

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 <chasel.chiu at intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
Cc: Isaac Oram <isaac.w.oram at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>
Cc: Eric Dong <eric.dong at intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki at microsoft.com>
---
 Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.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/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
index 9ee9dd252c7e..a30b69dd787c 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckMemoryTypeInformation.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh
+++ eckMemoryTypeInformation.c
@@ -22,8 +22,8 @@ ShortNameOfMemoryType(
 
 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 (
     }
 
     if (Next != Previous) {
-      PreviousMemoryTypeInformation[Index].NumberOfPages = Next;
       MemoryTypeInformationModified = TRUE;
     }
 
@@ -110,7 +109,7 @@ TestPointCheckMemoryTypeInformation (
   VOID                    *CurrentMemoryTypeInformation;
   VOID                    *PreviousMemoryTypeInformation;
   VOID                    *VariableMemoryTypeInformation;
-  
+
   DEBUG ((DEBUG_INFO, "==== TestPointCheckMemoryTypeInformation - Enter\n"));
   CurrentMemoryTypeInformation = NULL;
   PreviousMemoryTypeInformation = NULL;
--
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92175): https://edk2.groups.io/g/devel/message/92175
Mute This Topic: https://groups.io/mt/92839532/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list