From 976d0353a6ce48149039849b52bb67527be5b580 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Fri, 13 Sep 2019 21:06:19 +0200 Subject: [PATCH] UefiPayloadPkg/BlSupportDxe: fix ReserveResourceInGcd() calls The last parameter of ReserveResourceInGcd() is "ImageHandle", forwarded in turn to gDS->AllocateMemorySpace() or gDS->AllocateIoSpace() as "owner" image handle. But BlDxeEntryPoint() passes "SystemTable" as "ImageHandle". Compilers have not flagged it because EFI_HANDLE (the type of "ImageHandle") is unfortunately specified as (VOID*), and (EFI_SYSTEM_TABLE*) converts to (VOID*) silently. Hand the entry point function's "ImageHandle" parameter to ReserveResourceInGcd(). This fixes an actual bug. Cc: Benjamin You Cc: Guo Dong Cc: Maurice Ma Signed-off-by: Laszlo Ersek Reviewed-by: Guo Dong Reviewed-by: Philippe Mathieu-Daude --- UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c index bcee4cd9bc..28dfc8fc55 100644 --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c @@ -106,10 +106,10 @@ BlDxeEntryPoint ( // // Report MMIO/IO Resources // - Status = ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFEC00000, SIZE_4KB, 0, SystemTable); // IOAPIC + Status = ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFEC00000, SIZE_4KB, 0, ImageHandle); // IOAPIC ASSERT_EFI_ERROR (Status); - Status = ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFED00000, SIZE_1KB, 0, SystemTable); // HPET + Status = ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFED00000, SIZE_1KB, 0, ImageHandle); // HPET ASSERT_EFI_ERROR (Status); // -- 2.39.2