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.web11.675.1617732761870187237 for ; Tue, 06 Apr 2021 11:12:42 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=XWkEMmH9; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from localhost.localdomain (unknown [167.220.2.74]) by linux.microsoft.com (Postfix) with ESMTPSA id 5B14020B5680; Tue, 6 Apr 2021 11:12:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5B14020B5680 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1617732761; bh=ptz8/M5qOAWn+Mg7cvm31+fxKHpN4xcW/25adbJvy40=; h=From:To:Cc:Subject:Date:From; b=XWkEMmH98vO65oTKUPk14IIJGsp4HV9ZjrI1lSSewfA0rqr6Qv491Z11G4UwML15B 8ZkT3Ya2Sn98h7baVlthRorjzWiElcEU8wQ93ry36cSg/A+5ms7lT6gas+1BhmAhT+ moXjBLo+vXn9EHcrUigKHyoaroWmUSvPMF4FVjP4= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Laszlo Ersek , Jiewen Yao , Jian J Wang , Qi Zhang , Rahul Kumar , Kun Qin , Jiewen Yao Subject: [PATCH v2 1/1] SecurityPkg/Tcg2Smm: Initialize local Status variable Date: Tue, 6 Apr 2021 11:12:07 -0700 Message-Id: <20210406181207.8731-1-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.28.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3277 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] Initializing this variable is required to address a practical scenario in which the return value of TcgMmReadyToLock() is undefined based on conditional evaluation in the function. Cc: Jiewen Yao Cc: Jian J Wang Cc: Qi Zhang Cc: Rahul Kumar Cc: Kun Qin Signed-off-by: Michael Kubacki Reviewed-by: Jiewen Yao --- Notes: V2 change: =20 Clarify in commit message that the issue reported by Clang is not solely a false positive. 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; =20 + Status =3D EFI_SUCCESS; + if (mReadyToLockHandle !=3D NULL) { Status =3D gMmst->MmiHandlerUnRegister (mReadyToLockHandle); mReadyToLockHandle =3D NULL; --=20 2.28.0.windows.1