* [PATCH v2 1/1] SecurityPkg/Tcg2Smm: Initialize local Status variable
@ 2021-04-06 18:12 Michael Kubacki
2021-04-07 16:06 ` Laszlo Ersek
0 siblings, 1 reply; 4+ messages in thread
From: Michael Kubacki @ 2021-04-06 18:12 UTC (permalink / raw)
To: devel
Cc: Laszlo Ersek, Jiewen Yao, Jian J Wang, Qi Zhang, Rahul Kumar,
Kun Qin, Jiewen Yao
From: Michael Kubacki <michael.kubacki@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@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Qi Zhang <qi1.zhang@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Kun Qin <kun.q@outlook.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@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;
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] SecurityPkg/Tcg2Smm: Initialize local Status variable
2021-04-06 18:12 [PATCH v2 1/1] SecurityPkg/Tcg2Smm: Initialize local Status variable Michael Kubacki
@ 2021-04-07 16:06 ` Laszlo Ersek
2021-04-12 17:54 ` [edk2-devel] " Michael Kubacki
0 siblings, 1 reply; 4+ messages in thread
From: Laszlo Ersek @ 2021-04-07 16:06 UTC (permalink / raw)
To: mikuback, devel; +Cc: Jiewen Yao, Jian J Wang, Qi Zhang, Rahul Kumar, Kun Qin
On 04/06/21 20:12, mikuback@linux.microsoft.com wrote:
> From: Michael Kubacki <michael.kubacki@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@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Qi Zhang <qi1.zhang@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Kun Qin <kun.q@outlook.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> Reviewed-by: Jiewen Yao <Jiewen.yao@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@redhat.com>
Thanks
Laszlo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-devel] [PATCH v2 1/1] SecurityPkg/Tcg2Smm: Initialize local Status variable
2021-04-07 16:06 ` Laszlo Ersek
@ 2021-04-12 17:54 ` Michael Kubacki
2021-04-13 2:02 ` Wang, Jian J
0 siblings, 1 reply; 4+ messages in thread
From: Michael Kubacki @ 2021-04-12 17:54 UTC (permalink / raw)
To: devel, lersek; +Cc: Jiewen Yao, Jian J Wang, Qi Zhang, Rahul Kumar, Kun Qin
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@linux.microsoft.com wrote:
>> From: Michael Kubacki <michael.kubacki@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@intel.com>
>> Cc: Jian J Wang <jian.j.wang@intel.com>
>> Cc: Qi Zhang <qi1.zhang@intel.com>
>> Cc: Rahul Kumar <rahul1.kumar@intel.com>
>> Cc: Kun Qin <kun.q@outlook.com>
>> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
>> Reviewed-by: Jiewen Yao <Jiewen.yao@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@redhat.com>
>
> Thanks
> Laszlo
>
>
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-devel] [PATCH v2 1/1] SecurityPkg/Tcg2Smm: Initialize local Status variable
2021-04-12 17:54 ` [edk2-devel] " Michael Kubacki
@ 2021-04-13 2:02 ` Wang, Jian J
0 siblings, 0 replies; 4+ messages in thread
From: Wang, Jian J @ 2021-04-13 2:02 UTC (permalink / raw)
To: Michael Kubacki, devel@edk2.groups.io, lersek@redhat.com
Cc: Yao, Jiewen, Zhang, Qi1, Kumar, Rahul1, Kun Qin
Pushed @ 54211ab10fcd8532b49f4024ebdb601a8eb07e3e
Regards,
Jian
> -----Original Message-----
> From: Michael Kubacki <mikuback@linux.microsoft.com>
> Sent: Tuesday, April 13, 2021 1:54 AM
> To: devel@edk2.groups.io; lersek@redhat.com
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>;
> Zhang, Qi1 <qi1.zhang@intel.com>; Kumar, Rahul1 <rahul1.kumar@intel.com>;
> Kun Qin <kuqin12@gmail.com>
> Subject: Re: [edk2-devel] [PATCH v2 1/1] SecurityPkg/Tcg2Smm: Initialize local
> Status variable
>
> 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@linux.microsoft.com wrote:
> >> From: Michael Kubacki <michael.kubacki@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@intel.com>
> >> Cc: Jian J Wang <jian.j.wang@intel.com>
> >> Cc: Qi Zhang <qi1.zhang@intel.com>
> >> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> >> Cc: Kun Qin <kun.q@outlook.com>
> >> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> >> Reviewed-by: Jiewen Yao <Jiewen.yao@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@redhat.com>
> >
> > Thanks
> > Laszlo
> >
> >
> >
> >
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-13 2:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-06 18:12 [PATCH v2 1/1] SecurityPkg/Tcg2Smm: Initialize local Status variable Michael Kubacki
2021-04-07 16:06 ` Laszlo Ersek
2021-04-12 17:54 ` [edk2-devel] " Michael Kubacki
2021-04-13 2:02 ` Wang, Jian J
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox