* [PATCH] OvmfPkg/EnrollDefaultKeys: suppress incorrect compiler warning
@ 2019-04-30 21:33 Laszlo Ersek
2019-05-01 6:32 ` Ard Biesheuvel
0 siblings, 1 reply; 2+ messages in thread
From: Laszlo Ersek @ 2019-04-30 21:33 UTC (permalink / raw)
To: edk2-devel-groups-io; +Cc: Ard Biesheuvel, Jordan Justen
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>.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Fixes: be9470b3c91fc50436c15a76c85cdde940355b9f
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
index b7b2e424c59e..75f2749dc84a 100644
--- a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
+++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
@@ -554,14 +554,21 @@ ShellAppMain (
PrintSettings (&Settings);
if (Settings.SetupMode != 1) {
AsciiPrint ("error: already in User Mode\n");
return RetVal;
}
+ //
+ // Set PkKek1 and SizeOfPkKek1 to suppress incorrect compiler/analyzer
+ // warnings.
+ //
+ PkKek1 = NULL;
+ SizeOfPkKek1 = 0;
+
//
// Fetch the X509 certificate (to be used as Platform Key and first Key
// Exchange Key) from SMBIOS.
//
Status = GetPkKek1 (&PkKek1, &SizeOfPkKek1);
if (EFI_ERROR (Status)) {
return RetVal;
--
2.19.1.3.g30247aa5d201
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] OvmfPkg/EnrollDefaultKeys: suppress incorrect compiler warning
2019-04-30 21:33 [PATCH] OvmfPkg/EnrollDefaultKeys: suppress incorrect compiler warning Laszlo Ersek
@ 2019-05-01 6:32 ` Ard Biesheuvel
0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2019-05-01 6:32 UTC (permalink / raw)
To: Laszlo Ersek; +Cc: edk2-devel-groups-io, Jordan Justen
On Tue, 30 Apr 2019 at 23:33, Laszlo Ersek <lersek@redhat.com> wrote:
>
> 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>.
>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Fixes: be9470b3c91fc50436c15a76c85cdde940355b9f
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Thanks Laszlo
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Pushed as 273190e18975..727d7ebaa9f3
> ---
> OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
> index b7b2e424c59e..75f2749dc84a 100644
> --- a/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
> +++ b/OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.c
> @@ -554,14 +554,21 @@ ShellAppMain (
> PrintSettings (&Settings);
>
> if (Settings.SetupMode != 1) {
> AsciiPrint ("error: already in User Mode\n");
> return RetVal;
> }
>
> + //
> + // Set PkKek1 and SizeOfPkKek1 to suppress incorrect compiler/analyzer
> + // warnings.
> + //
> + PkKek1 = NULL;
> + SizeOfPkKek1 = 0;
> +
> //
> // Fetch the X509 certificate (to be used as Platform Key and first Key
> // Exchange Key) from SMBIOS.
> //
> Status = GetPkKek1 (&PkKek1, &SizeOfPkKek1);
> if (EFI_ERROR (Status)) {
> return RetVal;
> --
> 2.19.1.3.g30247aa5d201
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-01 6:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-30 21:33 [PATCH] OvmfPkg/EnrollDefaultKeys: suppress incorrect compiler warning Laszlo Ersek
2019-05-01 6:32 ` Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox