Update the MadtLen varaible before the next record is read,
to void infinite loop.

Cc: Chasel Chiu <chasel.c...@intel.com>
Cc: Nate DeSimone <nathaniel.l.desim...@intel.com>
Cc: Liming Gao <gaolim...@byosoft.com.cn>
Cc: Eric Dong <eric.d...@intel.com>
Signed-off-by: Abdul Lateef Attar <abdullateef.at...@amd.com>
---
 .../Test/Library/TestPointCheckLib/DxeCheckAcpiMadt.c      | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckAcpiMadt.c
 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckAcpiMadt.c
index 7e29b47a0b..04cc6f963a 100644
--- 
a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckAcpiMadt.c
+++ 
b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckAcpiMadt.c
@@ -1,6 +1,7 @@
 /** @file
 
 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -235,8 +236,9 @@ DumpAcpiMadt (
       DEBUG ((DEBUG_INFO, "\n"));
       break;
     }
-    ApicStructHeader = (APIC_STRUCT_HEADER *)((UINT8 *)ApicStructHeader + 
ApicStructHeader->Length);
+    // Update MadtLen first to avoid the dead loop and system hang
     MadtLen         -= ApicStructHeader->Length;
+    ApicStructHeader = (APIC_STRUCT_HEADER *)((UINT8 *)ApicStructHeader + 
ApicStructHeader->Length);
   }
 }
 
@@ -324,8 +326,9 @@ CheckAcpiMadt (
     default:
       break;
     }
-    ApicStructHeader = (APIC_STRUCT_HEADER *)((UINT8 *)ApicStructHeader + 
ApicStructHeader->Length);
+    // Update MadtLen first to avoid the dead loop and system hang
     MadtLen         -= ApicStructHeader->Length;
+    ApicStructHeader = (APIC_STRUCT_HEADER *)((UINT8 *)ApicStructHeader + 
ApicStructHeader->Length);
   }
   return EFI_SUCCESS;
 }
\ No newline at end of file
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118095): https://edk2.groups.io/g/devel/message/118095
Mute This Topic: https://groups.io/mt/105669987/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to