[edk2-devel] [PATCH 24/35] OvmfPkg/PlatformDxe: fix EFI_HII_HANDLE parameters of internal functions
Ard Biesheuvel
ard.biesheuvel at linaro.org
Wed Sep 25 15:57:00 UTC 2019
On Tue, 17 Sep 2019 at 21:50, Laszlo Ersek <lersek at redhat.com> 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: Ard Biesheuvel <ard.biesheuvel at linaro.org>
> ---
>
> 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,
> --
> 2.19.1.3.g30247aa5d201
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#48040): https://edk2.groups.io/g/devel/message/48040
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