]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/GenericQemuLoadImageLib: Fix VS2019 UINT32 conversion error
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Sun, 29 Mar 2020 13:44:38 +0000 (15:44 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 30 Mar 2020 12:05:28 +0000 (12:05 +0000)
Building OVMF for X64 with secure boot enabled on VS2019 results in
the following error:

  d:\a\1\s\OvmfPkg\Library\GenericQemuLoadImageLib\GenericQemuLoadImageLib.c(154):
    error C2220: the following warning is treated as an error
  d:\a\1\s\OvmfPkg\Library\GenericQemuLoadImageLib\GenericQemuLoadImageLib.c(154):
    warning C4244: '=': conversion from 'UINTN' to 'UINT32', possible loss of data

Suppress the error by making the cast explicit.

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=2636
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.c

index f7f9a205f99d5bb033bef79fa5886f73e1f999a0..14c8417d43e7f9af482ef01ae3911be5fa7c7f4b 100644 (file)
@@ -151,7 +151,7 @@ QemuLoadKernelImage (
     //\r
     // Drop the terminating NUL, convert to UTF-16.\r
     //\r
-    KernelLoadedImage->LoadOptionsSize = (CommandLineSize - 1) * 2;\r
+    KernelLoadedImage->LoadOptionsSize = (UINT32)((CommandLineSize - 1) * 2);\r
   }\r
 \r
   QemuFwCfgSelectItem (QemuFwCfgItemInitrdSize);\r