public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael Kubacki" <mikuback@linux.microsoft.com>
To: devel@edk2.groups.io
Cc: Chasel Chiu <chasel.chiu@intel.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Isaac Oram <isaac.w.oram@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Eric Dong <eric.dong@intel.com>
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Prevent modification of HOB data
Date: Fri,  5 Aug 2022 13:15:32 -0400	[thread overview]
Message-ID: <20220805171532.868-1-mikuback@linux.microsoft.com> (raw)

From: Michael Kubacki <michael.kubacki@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@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@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/DxeCheckMemoryTypeInformation.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


             reply	other threads:[~2022-08-05 17:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05 17:15 Michael Kubacki [this message]
2022-08-05 20:29 ` [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Prevent modification of HOB data Oram, Isaac W
     [not found] ` <17088CED31060862.21918@groups.io>
2022-08-08 19:02   ` [edk2-devel] " Oram, Isaac W

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220805171532.868-1-mikuback@linux.microsoft.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox