[edk2-devel] [PATCH v2 1/1] SecurityPkg/Tcg2Smm: Initialize local Status variable
Michael Kubacki
mikuback at linux.microsoft.com
Mon Apr 12 17:54:22 UTC 2021
Hi Laszlo and SecurityPkg maintainers,
This is a relatively straightforward patch. Please let me know if
anything else is needed for you to submit it.
Thanks,
Michael
On 4/7/2021 9:06 AM, Laszlo Ersek wrote:
> On 04/06/21 20:12, mikuback at linux.microsoft.com wrote:
>> From: Michael Kubacki <michael.kubacki at 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]
>>
>> 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 <jiewen.yao at intel.com>
>> Cc: Jian J Wang <jian.j.wang at intel.com>
>> Cc: Qi Zhang <qi1.zhang at intel.com>
>> Cc: Rahul Kumar <rahul1.kumar at intel.com>
>> Cc: Kun Qin <kun.q at outlook.com>
>> Signed-off-by: Michael Kubacki <michael.kubacki at microsoft.com>
>> Reviewed-by: Jiewen Yao <Jiewen.yao at intel.com>
>> ---
>>
>> 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 <lersek at redhat.com>
>
> Thanks
> Laszlo
>
>
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73975): https://edk2.groups.io/g/devel/message/73975
Mute This Topic: https://groups.io/mt/81896951/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list