[edk2-devel] [PATCH] OvmfPkg/EnrollDefaultKeys: suppress incorrect compiler warning

Ard Biesheuvel ard.biesheuvel at linaro.org
Wed May 1 06:32:25 UTC 2019


On Tue, 30 Apr 2019 at 23:33, Laszlo Ersek <lersek at 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 at linaro.org>
> Cc: Jordan Justen <jordan.l.justen at intel.com>
> Reported-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>
> Fixes: be9470b3c91fc50436c15a76c85cdde940355b9f
> Signed-off-by: Laszlo Ersek <lersek at redhat.com>

Thanks Laszlo

Reviewed-by: Ard Biesheuvel <ard.biesheuvel at 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
>

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#39888): https://edk2.groups.io/g/devel/message/39888
Mute This Topic: https://groups.io/mt/31425619/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