Skip to content

Commit

Permalink
MinPlatformPkg/Test: Fix DumpAcpiMadt infinite loop
Browse files Browse the repository at this point in the history
Update the MadtLen varaible before the next record is read,
to void infinite loop.

Cc: Chasel Chiu <[email protected]>
Reviewed-by: Nate DeSimone <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Eric Dong <[email protected]>
Signed-off-by: Abdul Lateef Attar <[email protected]>
  • Loading branch information
Abdul Lateef Attar authored and makubacki committed May 14, 2024
1 parent 9bc93db commit cc6d10c
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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
**/
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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;
}

0 comments on commit cc6d10c

Please sign in to comment.