<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank Dun for the fix.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com><br>
</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Tan, Dun <dun.tan@intel.com><br>
<b>Sent:</b> Tuesday, August 31, 2021 13:38<br>
<b>To:</b> devel@edk2.groups.io <devel@edk2.groups.io><br>
<b>Cc:</b> Dong, Guo <guo.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Ma, Maurice <maurice.ma@intel.com>; You, Benjamin <benjamin.you@intel.com>; Liu, Zhiguang <zhiguang.liu@intel.com>; Tan, Dun <dun.tan@intel.com><br>
<b>Subject:</b> [Patch V2 1/2] UefiPayloadPkg: Fix the bug in dump guid HOB info functions</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">The input HobLength of PrintHandler should be data size instead of whole length of HOB<br>
<br>
Cc: Guo Dong <guo.dong@intel.com><br>
Cc: Ray Ni <ray.ni@intel.com><br>
Cc: Maurice Ma <maurice.ma@intel.com><br>
Cc: Benjamin You <benjamin.you@intel.com><br>
Cc: Zhiguang Liu <zhiguang.liu@intel.com><br>
Signed-off-by: DunTan <dun.tan@intel.com><br>
---<br>
 UefiPayloadPkg/UefiPayloadEntry/PrintHob.c | 10 +++++++---<br>
 1 file changed, 7 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c<br>
index 5fb638d4a4..f93aeec472 100644<br>
--- a/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c<br>
+++ b/UefiPayloadPkg/UefiPayloadEntry/PrintHob.c<br>
@@ -317,9 +317,11 @@ PrintPciRootBridgeInfoGuidHob (<br>
 {<br>
   UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *PciRootBridges;<br>
   UINTN                              Index;<br>
+  UINTN                              Length;<br>
   Index = 0;<br>
   PciRootBridges = (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *) GET_GUID_HOB_DATA (HobRaw);<br>
-  ASSERT (HobLength >= sizeof (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES));<br>
+  Length = sizeof (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES) + PciRootBridges->Count * sizeof (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE);<br>
+  ASSERT (HobLength >= Length);<br>
   DEBUG ((DEBUG_INFO, "   Revision         = 0x%x\n", PciRootBridges->Header.Revision));<br>
   DEBUG ((DEBUG_INFO, "   Length           = 0x%x\n", PciRootBridges->Header.Length));<br>
   DEBUG ((DEBUG_INFO, "   Count            = 0x%x\n", PciRootBridges->Count));<br>
@@ -369,10 +371,12 @@ PrintExtraDataGuidHob (<br>
 {<br>
   UNIVERSAL_PAYLOAD_EXTRA_DATA *ExtraData;<br>
   UINTN                        Index;<br>
+  UINTN                        Length;<br>
 <br>
   Index     = 0;<br>
   ExtraData = (UNIVERSAL_PAYLOAD_EXTRA_DATA *) GET_GUID_HOB_DATA (HobRaw);<br>
-  ASSERT (HobLength >= ExtraData->Header.Length);<br>
+  Length = sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA) + ExtraData->Count * sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY);<br>
+  ASSERT (HobLength >= Length);<br>
   DEBUG ((DEBUG_INFO, "   Revision  = 0x%x\n", ExtraData->Header.Revision));<br>
   DEBUG ((DEBUG_INFO, "   Length    = 0x%x\n", ExtraData->Header.Length));<br>
   DEBUG ((DEBUG_INFO, "   Count     = 0x%x\n", ExtraData->Count));<br>
@@ -443,7 +447,7 @@ PrintGuidHob (<br>
   for (Index = 0; Index < ARRAY_SIZE (GuidHobPrintHandleTable); Index++) {<br>
     if (CompareGuid (&Hob.Guid->Name, GuidHobPrintHandleTable[Index].Guid)) {<br>
       DEBUG ((DEBUG_INFO, "   Guid   = %a\n", GuidHobPrintHandleTable[Index].GuidName));<br>
-      Status = GuidHobPrintHandleTable[Index].PrintHandler (Hob.Raw, Hob.Header->HobLength);<br>
+      Status = GuidHobPrintHandleTable[Index].PrintHandler (Hob.Raw, GET_GUID_HOB_DATA_SIZE (Hob.Raw));<br>
       return Status;<br>
     }<br>
   }<br>
-- <br>
2.31.1.windows.1<br>
<br>
</div>
</span></font></div>
</body>
</html>


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr>   Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/80392">View/Reply Online (#80392)</a> |    |  <a target="_blank" href="https://groups.io/mt/85270356/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>