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 <michael.kuba...@microsoft.com>

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 <jiewen....@intel.com>
Cc: Jian J Wang <jian.j.w...@intel.com>
Cc: Qi Zhang <qi1.zh...@intel.com>
Cc: Rahul Kumar <rahul1.ku...@intel.com>
Cc: Kun Qin <ku...@outlook.com>
Signed-off-by: Michael Kubacki <michael.kuba...@microsoft.com>
---
  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







-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73733): https://edk2.groups.io/g/devel/message/73733
Mute This Topic: https://groups.io/mt/81617668/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to