From 68c9706678b27af7c400a58b56c60b85e854af22 Mon Sep 17 00:00:00 2001 From: Rajat Goyal Date: Thu, 7 May 2026 17:56:29 +0000 Subject: [PATCH] fix(pal/uefi_acpi): update MemoryMapSize after memory map allocation Recompute MemoryMapSize from the allocated page count before retrying GetMemoryMap. This keeps the buffer size passed to GetMemoryMap aligned with the actual allocation size after AllocatePages succeeds. Previously, the retry path allocated memory based on the required page count but continued using the earlier MemoryMapSize value. Updating it with EFI_PAGES_TO_SIZE(Pages) ensures the firmware receives the correct buffer size for the allocated memory map buffer. Signed-off-by: Rajat Goyal Change-Id: I9ceaac06f73aee6797c225ea540d502095390d99 --- pal/uefi_acpi/src/pal_peripherals.c | 1 + 1 file changed, 1 insertion(+) diff --git a/pal/uefi_acpi/src/pal_peripherals.c b/pal/uefi_acpi/src/pal_peripherals.c index 1655abf7..ed3abcb8 100644 --- a/pal/uefi_acpi/src/pal_peripherals.c +++ b/pal/uefi_acpi/src/pal_peripherals.c @@ -303,6 +303,7 @@ pal_memory_create_info_table(MEMORY_INFO_TABLE *memoryInfoTable) Status = EFI_OUT_OF_RESOURCES; return; } + MemoryMapSize = EFI_PAGES_TO_SIZE (Pages); Status = gBS->GetMemoryMap (&MemoryMapSize, MemoryMap, &MapKey, &DescriptorSize, &DescriptorVersion); }