]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiPayloadPkg/BlSupportDxe: fix ReserveResourceInGcd() calls
authorLaszlo Ersek <lersek@redhat.com>
Fri, 13 Sep 2019 19:06:19 +0000 (21:06 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 9 Oct 2019 07:40:10 +0000 (09:40 +0200)
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 <benjamin.you@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c

index bcee4cd9bc41eda0e69c44edf8b3a7d17366d1b5..28dfc8fc5545c8754c8a334a325549bc25f2df05 100644 (file)
@@ -106,10 +106,10 @@ BlDxeEntryPoint (
   //\r
   // Report MMIO/IO Resources\r
   //\r
-  Status = ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFEC00000, SIZE_4KB, 0, SystemTable); // IOAPIC\r
+  Status = ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFEC00000, SIZE_4KB, 0, ImageHandle); // IOAPIC\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  Status = ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFED00000, SIZE_1KB, 0, SystemTable); // HPET\r
+  Status = ReserveResourceInGcd (TRUE, EfiGcdMemoryTypeMemoryMappedIo, 0xFED00000, SIZE_1KB, 0, ImageHandle); // HPET\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r