From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=cAiLw+TL; spf=pass (domain: linaro.org, ip: 209.85.166.65, mailfrom: ard.biesheuvel@linaro.org) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by groups.io with SMTP; Tue, 30 Apr 2019 23:32:39 -0700 Received: by mail-io1-f65.google.com with SMTP id m188so14195869ioa.9 for ; Tue, 30 Apr 2019 23:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YXHuB7P7D0dyE4ZB4S1RBiFtmebJPTIiPIHU/9v6voM=; b=cAiLw+TLK/M6E3CsyGvNwlVDNZPVQvuKr/yPTenH4U6lI1Te10/gY3+HuVWxpwitSJ O4k9DxxpKJTgdAlIre5bXYFYZidh7uEe7UGIvn2mjzoH7AdT0o1AArL+xng6VOxFljFj 41s4hkoRggLFPUypvX+g1GWCWFhvcn4o4EtJ54bDB1OUQ8lVrNQQboj9mZsO+Q/cRF52 klVDIOOCl0k2eR8UYWwqSsM5Th5EMiJ55nuy72XX32LZv2Cn48joH9Z4HcJubX33MAV7 rjT1hbf5TC6U9IjJdiK7/BQIpXBIWjqrB1fUW2KLeys069QL4dJjSwvT7nQdo1Hjw97q U/Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YXHuB7P7D0dyE4ZB4S1RBiFtmebJPTIiPIHU/9v6voM=; b=kCpi69/W9gCiIQWZRh5QqiNSY2iT5beiOe8g6tjzgtVxmtYAXilMgT07RdPFt8Zzjb dlffAGtY7poOIHtYlrINVQMtiYskT68NNeo8ygiawObPmB/geaBm1Uk75GLuC60pDfo3 1JWSpACtP0okyn8xkeFXvhohDur85YGEua2xeC+D0/bAbLSJFtIbW6hKiLScR8p8Jg+E UxDZ27GH6ZN3xPpRFlM6vMlaiQYGjSGFLtdzSbk7y8YRhbf/Ae8+GPDjfDVfXxUdWiqR aHMVaaFMUzXcS3ifWTKl2u7+CksnQR916p0Z7FzGPd/gOSzmKlBUjyd3eO7hb/CV9aef A25A== X-Gm-Message-State: APjAAAVTLb7XKdzdnYIYZK/+rjRMTY6CE9K4V/tSz3y/mvEWAQTkUiWw mJ76S2Qb9PPBljC6+CSAFpbikxMywErGL7MTBX3HgA== X-Google-Smtp-Source: APXvYqzclyGWLwdhTovzgqC91bedwjqp0RGnFZc+VKtGLfmUigZCLn4pH1sHwLMJF9UpOm5z0fSlM6Tu3CXd8ggkqY4= X-Received: by 2002:a5e:9b17:: with SMTP id j23mr808115iok.60.1556692358809; Tue, 30 Apr 2019 23:32:38 -0700 (PDT) MIME-Version: 1.0 References: <20190430213339.23769-1-lersek@redhat.com> In-Reply-To: <20190430213339.23769-1-lersek@redhat.com> From: "Ard Biesheuvel" Date: Wed, 1 May 2019 08:32:25 +0200 Message-ID: Subject: Re: [PATCH] OvmfPkg/EnrollDefaultKeys: suppress incorrect compiler warning To: Laszlo Ersek Cc: edk2-devel-groups-io , Jordan Justen Content-Type: text/plain; charset="UTF-8" On Tue, 30 Apr 2019 at 23:33, Laszlo Ersek 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 > . > > Cc: Ard Biesheuvel > Cc: Jordan Justen > Reported-by: Ard Biesheuvel > Fixes: be9470b3c91fc50436c15a76c85cdde940355b9f > Signed-off-by: Laszlo Ersek Thanks Laszlo Reviewed-by: Ard Biesheuvel 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 >