From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web10.14523.1583341122527197881 for ; Wed, 04 Mar 2020 08:58:42 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OfYVXxgV; spf=pass (domain: redhat.com, ip: 207.211.31.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583341121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bzv/ggKaA9SIh+nYX0yr2kEjxddtwqrF++A5SAHj1Dc=; b=OfYVXxgVYeLqthUBX0Jn0NDFReR6RXcwxyBJKK43nMWjq398LONy5NWdI5xp1ofDevFhSR ypbbJLq+2xyTuo/AxbvrOxvs0ixtTDLwZ7IEZIvwQ7VegDHAinkdMsRPaYsDWaXtVjCK5t 0x3YmVMkW7K8aSq3vjHx0GMSWNYCB8k= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-401-yws8UD1pMz-q5RcYchEiUw-1; Wed, 04 Mar 2020 11:58:39 -0500 X-MC-Unique: yws8UD1pMz-q5RcYchEiUw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F0DFDB62; Wed, 4 Mar 2020 16:58:36 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-117-59.ams2.redhat.com [10.36.117.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0201A9CA3; Wed, 4 Mar 2020 16:58:35 +0000 (UTC) Subject: Re: [PATCH 1/1] OvmfPkg/LinuxInitrdDynamicShellCommand: fix uninitialized status return To: Ard Biesheuvel , devel@edk2.groups.io References: <20200304114919.8746-1-ard.biesheuvel@linaro.org> From: "Laszlo Ersek" Message-ID: Date: Wed, 4 Mar 2020 17:58:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200304114919.8746-1-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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 Thanks Laszlo