]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/PlatformDxe: fix EFI_HII_HANDLE parameters of internal functions
authorLaszlo Ersek <lersek@redhat.com>
Thu, 12 Sep 2019 21:53:16 +0000 (23:53 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 9 Oct 2019 07:40:10 +0000 (09:40 +0200)
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@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
OvmfPkg/PlatformDxe/Platform.c

index 09181769babf44c65e32288c6d47a19d4c389411..23ad43901f66cfd9c53da70901683751be08d378 100644 (file)
@@ -486,7 +486,7 @@ STATIC
 EFI_STATUS\r
 EFIAPI\r
 CreateResolutionOptions (\r
-  IN  EFI_HII_HANDLE  *PackageList,\r
+  IN  EFI_HII_HANDLE  PackageList,\r
   OUT VOID            **OpCodeBuffer,\r
   IN  UINTN           NumGopModes,\r
   IN  GOP_MODE        *GopModes\r
@@ -547,7 +547,7 @@ STATIC
 EFI_STATUS\r
 EFIAPI\r
 PopulateForm (\r
-  IN  EFI_HII_HANDLE  *PackageList,\r
+  IN  EFI_HII_HANDLE  PackageList,\r
   IN  EFI_GUID        *FormSetGuid,\r
   IN  EFI_FORM_ID     FormId,\r
   IN  UINTN           NumGopModes,\r