From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.1021.1617733716848865300 for ; Tue, 06 Apr 2021 11:28:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=KHXxGA1Y; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from [10.124.238.202] (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id 449DE20B5680; Tue, 6 Apr 2021 11:28:36 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 449DE20B5680 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1617733716; bh=I+atUQMq7OGjOcmjtjFU2kd5hb+93WiIRvD+d5KU6zA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=KHXxGA1YS0mseRF1UkIkMwPgCl9nJIVRujkPyBh26k1G/zDzhrTueFl+TuTzOqf2M MKIE4ZQtyPIDbIprJXyHH/tqejQryETa7ugDv6ZajFlg+7TmNz+XgtiLdoE/pBK2PF 7N5Bn1w0rpPifm/XxImMN7OWmhFSQ6d5SYR3KyNA= Subject: Re: [edk2-devel] [PATCH v1 1/1] SecurityPkg/Tcg2Smm: Initialize local Status variable To: devel@edk2.groups.io, lersek@redhat.com Cc: Jiewen Yao , Jian J Wang , Qi Zhang , Rahul Kumar , Kun Qin References: <20210326004210.1305-1-mikuback@linux.microsoft.com> <540e99e6-2938-afdf-e788-fbced3961506@redhat.com> From: "Michael Kubacki" Message-ID: <45b3e804-ec49-6c5f-4bea-87c5e53769cc@linux.microsoft.com> Date: Tue, 6 Apr 2021 11:28:37 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <540e99e6-2938-afdf-e788-fbced3961506@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Hi Laszlo, I believe this is an actual bug. I updated the commit message to clarify this in a v2 patch: https://edk2.groups.io/g/devel/message/73732 Thanks, Michael On 4/6/2021 7:29 AM, Laszlo Ersek wrote: > On 03/26/21 01:42, Michael Kubacki wrote: >> From: Michael Kubacki >> >> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3277 >> >> Initializes the Status variable in TcgMmReadyToLock(). >> >> Fixes a Clang build failure: >> Tcg2Smm.c - SecurityPkg\Tcg\Tcg2Smm\Tcg2Smm.c:254:7: error: >> variable 'Status' is used uninitialized whenever 'if' >> condition is false [-Werror,-Wsometimes-uninitialized] >> >> Cc: Jiewen Yao >> Cc: Jian J Wang >> Cc: Qi Zhang >> Cc: Rahul Kumar >> Cc: Kun Qin >> Signed-off-by: Michael Kubacki >> --- >> SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c >> index 589c08794bcf..f49eccb0bdf4 100644 >> --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c >> +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c >> @@ -253,6 +253,8 @@ TcgMmReadyToLock ( >> { >> EFI_STATUS Status; >> >> + Status = EFI_SUCCESS; >> + >> if (mReadyToLockHandle != NULL) { >> Status = gMmst->MmiHandlerUnRegister (mReadyToLockHandle); >> mReadyToLockHandle = NULL; >> > > Is this an actual bug in the code, or a clang code analyzer wart? > > The commit message should document which one it is. > > Furthermore, if the patch is for suppressing an invalid compiler > warning, then please add a comment of the format seen e.g. in commit > aa7596534987 ("MdeModulePkg: Initialize local variable value before they > are used", 2021-03-25). > > Thanks > Laszlo > > > > >