]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/EnrollDefaultKeys: suppress incorrect compiler warning
authorLaszlo Ersek <lersek@redhat.com>
Tue, 30 Apr 2019 21:33:39 +0000 (23:33 +0200)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 1 May 2019 06:30:35 +0000 (08:30 +0200)
When building OvmfPkg/EnrollDefaultKeys for IA32 with gcc-4.8 for the
DEBUG target (and possibly under other build configurations too), the
compiler incorrectly reports,

> OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c: In function
> 'ShellAppMain':
> OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c:631:10: error:
> 'SizeOfPkKek1' may be used uninitialized in this function
> [-Werror=maybe-uninitialized]
>    Status = EnrollListOfCerts (
>           ^
> OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c:703:12: error: 'PkKek1'
> may be used uninitialized in this function [-Werror=maybe-uninitialized]
>    FreePool (PkKek1);
>             ^
> cc1: all warnings being treated as errors

Suppress this warning, in the style suggested under
<https://bugzilla.tianocore.org/show_bug.cgi?id=607>.

Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Fixes: be9470b3c91fc50436c15a76c85cdde940355b9f
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c

index b7b2e424c59e8cac7b6496faa7e3a93960b91749..75f2749dc84acc7c518f6ffe98fec9e50f21aac1 100644 (file)
@@ -558,6 +558,13 @@ ShellAppMain (
     return RetVal;\r
   }\r
 \r
+  //\r
+  // Set PkKek1 and SizeOfPkKek1 to suppress incorrect compiler/analyzer\r
+  // warnings.\r
+  //\r
+  PkKek1 = NULL;\r
+  SizeOfPkKek1 = 0;\r
+\r
   //\r
   // Fetch the X509 certificate (to be used as Platform Key and first Key\r
   // Exchange Key) from SMBIOS.\r