From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web09.9430.1617811604328956473 for ; Wed, 07 Apr 2021 09:06:44 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HskflXC2; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617811603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OeceI2cIbVorahFDnHs49/OpR8IjQubhmhT7IwACIK8=; b=HskflXC2KP+VXvzPPmn29CpSN4em/KyvJ80uRw0TEJhi14sPuQO6ORmFaKCuncNrZ4aL8Y XfW6akfFtdTtKKyz0ptkVZkPxOW2CNDqT3VXB3c+e7TQgq0znTiM1Xk1dMwAroO2+aQgMM RKdOAc9MmaeHOfBFkQSRdrJ5uJ6Nqlo= 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-238-YX9AiFcMMRCFf7c9Lx2r2Q-1; Wed, 07 Apr 2021 12:06:39 -0400 X-MC-Unique: YX9AiFcMMRCFf7c9Lx2r2Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E1CBE107ACC7; Wed, 7 Apr 2021 16:06:36 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-38.ams2.redhat.com [10.36.112.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 444295C1C4; Wed, 7 Apr 2021 16:06:35 +0000 (UTC) Subject: Re: [PATCH v2 1/1] SecurityPkg/Tcg2Smm: Initialize local Status variable To: mikuback@linux.microsoft.com, devel@edk2.groups.io Cc: Jiewen Yao , Jian J Wang , Qi Zhang , Rahul Kumar , Kun Qin References: <20210406181207.8731-1-mikuback@linux.microsoft.com> From: "Laszlo Ersek" Message-ID: <2e577197-2381-4849-f4db-4e2f992cae66@redhat.com> Date: Wed, 7 Apr 2021 18:06:34 +0200 MIME-Version: 1.0 In-Reply-To: <20210406181207.8731-1-mikuback@linux.microsoft.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 04/06/21 20:12, mikuback@linux.microsoft.com 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] > > 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: > > 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; > > + Status = EFI_SUCCESS; > + > if (mReadyToLockHandle != NULL) { > Status = gMmst->MmiHandlerUnRegister (mReadyToLockHandle); > mReadyToLockHandle = NULL; > Awesome, thanks! I've also managed to look at the code now. Reviewed-by: Laszlo Ersek Thanks Laszlo