From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by mx.groups.io with SMTP id smtpd.web12.15256.1583343843122062893 for ; Wed, 04 Mar 2020 09:44:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=PGMWu7zP; spf=pass (domain: linaro.org, ip: 209.85.128.67, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f67.google.com with SMTP id p9so3132495wmc.2 for ; Wed, 04 Mar 2020 09:44:02 -0800 (PST) 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=sHYfvmYXfdzAoFmlSR3PjYKNEX6r+ca6+tyB7NXyb4U=; b=PGMWu7zPDyNslCEQGpUMcFleGF0XKMibGlToN/5Q7TgHHF9JFf8V1TJkRSvDvwajFN 4Aa6Yb5yzHKnrCyNJW84JVu0P4O8aBtR8w0ru/u+EwADaCqnEMcM1TjU6dvsg6M/a4kh X3OMwv1CrWZnrk2ziAjLPm8f92LP3YcK8wszlbgFTBmvxY2Fh/iyUrZOLvhstdBN8IYv k9o9Dab0PtnVhLajiTSqrLELtikE59TWOT0FFFz59qO///VAUXu2yod9x2QP/vJV8ALw R9sGBeM2Tnm6a9lkLU5B+20yYKP2wHIW9rlcN+A5N4UDXWkYttXOt4sv/+FOof+TNu0a aqNw== 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=sHYfvmYXfdzAoFmlSR3PjYKNEX6r+ca6+tyB7NXyb4U=; b=Y6fvE+3BMeSLU6+5nDL4V2fmV3dyNt0mX69iqUHYN2DQd5c7+m6Ihs0yyxy1IDDHON i2I5EOVBcL4qm9/iAgVcPX2Lyxj29bp1NR2udiyOExgdssqToZjmrAw+gsqO8iYU4EdL m2oZECgPGSXq7CmVPnCnROF9stXd39j+dBZnCjnwvO6lvRt3ZuUzaPGzAOVY7kFkcy7o cLGatvGHfYyb8oyf6gvuddvVa9leavJHdiJHDtSS+UsmKVVm/z1uXp+U249dsgbJnIFe ID92hOuIWvE2wGmHXBaSxQym3kaDw2K5R3OJ8OBkgRGLKjbFSnR0M+4LbwsF32LzKAJ5 0p2w== X-Gm-Message-State: ANhLgQ0ySLCBCFVEyMTF45gahbVSsqVDyP+JGvqLThpooObJyVfoGWAl pXA7pszZu2mSXQF/wFnGpNDjaqPeNN3MKUHR2WZSrQ== X-Google-Smtp-Source: ADFU+vsQF3NqriXr63re9q867xqt4HfyHJ9KswDaXxwVamfaaB6cmwhSdDT7knxoJDiZ2eatRjU0f0bOB57pZghcUmM= X-Received: by 2002:a1c:2d88:: with SMTP id t130mr4996156wmt.68.1583343841635; Wed, 04 Mar 2020 09:44:01 -0800 (PST) MIME-Version: 1.0 References: <20200304114919.8746-1-ard.biesheuvel@linaro.org> In-Reply-To: From: "Ard Biesheuvel" Date: Wed, 4 Mar 2020 18:43:50 +0100 Message-ID: Subject: Re: [PATCH 1/1] OvmfPkg/LinuxInitrdDynamicShellCommand: fix uninitialized status return To: Laszlo Ersek Cc: edk2-devel-groups-io Content-Type: text/plain; charset="UTF-8" On Wed, 4 Mar 2020 at 17:58, Laszlo Ersek wrote: > > On 03/04/20 12:49, Ard Biesheuvel wrote: > > The Linaro CI reports: > > > > OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c:132:7: > > error: variable 'Status' is used uninitialized whenever 'if' condition is > > false [-Werror,-Wsometimes-uninitialized] > > if (mInitrdLoadFile2Handle != NULL) { > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c:141:10: > > note: uninitialized use occurs here > > return Status; > > ^~~~~~ > > OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c:132:3: > > note: remove the 'if' if its condition is always true > > if (mInitrdLoadFile2Handle != NULL) { > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c:130:23: > > note: initialize the variable 'Status' to silence this warning > > EFI_STATUS Status; > > ^ > > = 0 > > > > Fix this by pulling the return of Status into the conditional block where > > it is assigned, and return EFI_SUCCESS otherwise. > > > > Signed-off-by: Ard Biesheuvel > > --- > > OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c b/OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c > > index ed8fbaa77069..021b072826a9 100644 > > --- a/OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c > > +++ b/OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.c > > @@ -137,8 +137,9 @@ UninstallLoadFile2Protocol ( > > if (!EFI_ERROR (Status)) { > > mInitrdLoadFile2Handle = NULL; > > } > > + return Status; > > } > > - return Status; > > + return EFI_SUCCESS; > > } > > > > STATIC > > > > I should have caught this in review. :/ > > Please add the following to the commit message: > > Fixes: 2632178bc683f1f28f9dbe269f85d6b26b1800de > Reviewed-by: Laszlo Ersek > Pushed as 6c6fef024718578596a3554e6d287a89aa49b950 Thanks.