[edk2-devel] [PATCH 24/35] OvmfPkg/PlatformDxe: fix EFI_HII_HANDLE parameters of internal functions

Philippe Mathieu-Daudé philmd at redhat.com
Fri Sep 20 14:56:50 UTC 2019


On 9/17/19 9:49 PM, Laszlo Ersek wrote:
> In the following call tree:
> 
>  PlatformInit ()
>    mInstalledPackages = HiiAddPackages ()
>  GopInstalled ()
>     PopulateForm (PackageList = mInstalledPackages)
>       CreateResolutionOptions (PackageList)
>         HiiSetString (PackageList
>       HiiUpdateForm (PackageList)
> 
> PlatformDxe passes around an EFI_HII_HANDLE that (a) originates from
> HiiAddPackages() and (b) is ultimately passed to HiiSetString() and
> HiiUpdateForm(). The intermediate functions PopulateForm() and
> CreateResolutionOptions() however take that parameter as an
> (EFI_HII_HANDLE*).
> 
> There is no bug in practice (because the affected functions never try to
> de-reference the "PackageList" parameter, they just pass it on), but the
> function prototypes are semantically wrong. Fix that.
> 
> This could remain hidden so long because pointer-to-VOID silently converts
> to/from any pointer-to-object type, and the UEFI spec mandates that
> EFI_HII_HANDLE be a typedef to (VOID*).
> 
> Cc: Ard Biesheuvel <ard.biesheuvel at linaro.org>
> Cc: Jordan Justen <jordan.l.justen at intel.com>
> Signed-off-by: Laszlo Ersek <lersek at redhat.com>

Reviewed-by: Philippe Mathieu-Daude <philmd at redhat.com>

> ---
> 
> Notes:
>     tested in UiApp
> 
>  OvmfPkg/PlatformDxe/Platform.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/OvmfPkg/PlatformDxe/Platform.c b/OvmfPkg/PlatformDxe/Platform.c
> index 09181769babf..23ad43901f66 100644
> --- a/OvmfPkg/PlatformDxe/Platform.c
> +++ b/OvmfPkg/PlatformDxe/Platform.c
> @@ -486,7 +486,7 @@ STATIC
>  EFI_STATUS
>  EFIAPI
>  CreateResolutionOptions (
> -  IN  EFI_HII_HANDLE  *PackageList,
> +  IN  EFI_HII_HANDLE  PackageList,
>    OUT VOID            **OpCodeBuffer,
>    IN  UINTN           NumGopModes,
>    IN  GOP_MODE        *GopModes
> @@ -547,7 +547,7 @@ STATIC
>  EFI_STATUS
>  EFIAPI
>  PopulateForm (
> -  IN  EFI_HII_HANDLE  *PackageList,
> +  IN  EFI_HII_HANDLE  PackageList,
>    IN  EFI_GUID        *FormSetGuid,
>    IN  EFI_FORM_ID     FormId,
>    IN  UINTN           NumGopModes,
> 

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

View/Reply Online (#47722): https://edk2.groups.io/g/devel/message/47722
Mute This Topic: https://groups.io/mt/34180225/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