[edk2-devel] [PATCH 35/35] UefiPayloadPkg/BlSupportDxe: fix ReserveResourceInGcd() calls

Guo Dong guo.dong at intel.com
Mon Sep 23 02:28:37 UTC 2019


Thanks for the fix.

Reviewed-by:  Guo Dong <guo.dong at intel.com>

> -----Original Message-----
> From: devel at edk2.groups.io [mailto:devel at edk2.groups.io] On Behalf Of
> Laszlo Ersek
> Sent: Tuesday, September 17, 2019 12:50 PM
> To: edk2-devel-groups-io <devel at edk2.groups.io>
> Cc: You, Benjamin <benjamin.you at intel.com>; Dong, Guo
> <guo.dong at intel.com>; Ma, Maurice <maurice.ma at intel.com>
> Subject: [edk2-devel] [PATCH 35/35] 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 <benjamin.you at intel.com>
> Cc: Guo Dong <guo.dong at intel.com>
> Cc: Maurice Ma <maurice.ma at intel.com>
> Signed-off-by: Laszlo Ersek <lersek at redhat.com>
> ---
> 
> Notes:
>     build-tested only
> 
>  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 bcee4cd9bc41..28dfc8fc5545 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.19.1.3.g30247aa5d201
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> 
> View/Reply Online (#47422): https://edk2.groups.io/g/devel/message/47422
> Mute This Topic: https://groups.io/mt/34180240/1781375
> Group Owner: devel+owner at edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub  [guo.dong at intel.com]
> -=-=-=-=-=-=


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#47784): https://edk2.groups.io/g/devel/message/47784
Mute This Topic: https://groups.io/mt/34180240/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list