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.web10.12733.1617719395540206634 for ; Tue, 06 Apr 2021 07:29:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=C7k3me/H; 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=1617719394; 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=b5mw7q6/zujJQa5PqosdDumQRvTXrJYAm38H2vZgvq4=; b=C7k3me/HY+4HSt82dtqs1WKYWo9cBIunXYO03FJVs2u3hxL85x4/CoPXZSqR0MJlKUhrE3 6vMtpKerJ0qOuRoYHxKT6Ha/dckeKu2/VJWzS2eBV7zyqyxQ68KPhjJjK1bjKb+UisVRJr 6UPL2N94FqWVzyTOcItP+xjzsycciyQ= 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-40-HhXW7k2dNcSJ4oDOMArZgg-1; Tue, 06 Apr 2021 10:29:51 -0400 X-MC-Unique: HhXW7k2dNcSJ4oDOMArZgg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 129E51007CAA; Tue, 6 Apr 2021 14:29:50 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-115-134.ams2.redhat.com [10.36.115.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BE725D9D0; Tue, 6 Apr 2021 14:29:48 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v1 1/1] SecurityPkg/Tcg2Smm: Initialize local Status variable To: devel@edk2.groups.io, mikuback@linux.microsoft.com Cc: Jiewen Yao , Jian J Wang , Qi Zhang , Rahul Kumar , Kun Qin References: <20210326004210.1305-1-mikuback@linux.microsoft.com> From: "Laszlo Ersek" Message-ID: <540e99e6-2938-afdf-e788-fbced3961506@redhat.com> Date: Tue, 6 Apr 2021 16:29:47 +0200 MIME-Version: 1.0 In-Reply-To: <20210326004210.1305-1-mikuback@linux.microsoft.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 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