public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1 1/1] FmpDevicePkg/FmpDxe: Fix Clang build error
@ 2020-08-12  0:23 Michael Kubacki
  2020-08-12  1:07 ` [edk2-devel] " Liming Gao
  2020-08-12  7:04 ` Guomin Jiang
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Kubacki @ 2020-08-12  0:23 UTC (permalink / raw)
  To: devel; +Cc: Liming Gao, Michael D Kinney, Guomin Jiang, Wei6 Xu

From: Michael Kubacki <michael.kubacki@microsoft.com>

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2887

The local Private pointer variable in SetTheImage() is initialized
based on the caller provided This pointer argument. The cleanup
label path uses the Private pointer which will not be
initialized if This is NULL.

This change initializes Private to NULL and accounts for Private
potentially being NULL in the cleanup label path.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
 FmpDevicePkg/FmpDxe/FmpDxe.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c
index 854feec0a162..427b215ddc5f 100644
--- a/FmpDevicePkg/FmpDxe/FmpDxe.c
+++ b/FmpDevicePkg/FmpDxe/FmpDxe.c
@@ -1043,6 +1043,7 @@ SetTheImage (
   UINT32                            DependenciesSize;
 
   Status             = EFI_SUCCESS;
+  Private            = NULL;
   Updateable         = 0;
   BooleanValue       = FALSE;
   FmpHeaderSize      = 0;
@@ -1293,7 +1294,10 @@ SetTheImage (
 
 cleanup:
   mProgressFunc = NULL;
-  SetLastAttemptStatusInVariable (Private, LastAttemptStatus);
+
+  if (Private != NULL) {
+    SetLastAttemptStatusInVariable (Private, LastAttemptStatus);
+  }
 
   if (Progress != NULL) {
     //
@@ -1306,7 +1310,9 @@ SetTheImage (
   // Need repopulate after SetImage is called to
   // update LastAttemptVersion and LastAttemptStatus.
   //
-  Private->DescriptorPopulated = FALSE;
+  if (Private != NULL) {
+    Private->DescriptorPopulated = FALSE;
+  }
 
   return Status;
 }
-- 
2.28.0.windows.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH v1 1/1] FmpDevicePkg/FmpDxe: Fix Clang build error
  2020-08-12  0:23 [PATCH v1 1/1] FmpDevicePkg/FmpDxe: Fix Clang build error Michael Kubacki
@ 2020-08-12  1:07 ` Liming Gao
  2020-08-12  7:04 ` Guomin Jiang
  1 sibling, 0 replies; 3+ messages in thread
From: Liming Gao @ 2020-08-12  1:07 UTC (permalink / raw)
  To: devel@edk2.groups.io, michael.kubacki@outlook.com
  Cc: Kinney, Michael D, Jiang, Guomin, Xu, Wei6

Tested-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael Kubacki
Sent: 2020年8月12日 8:24
To: devel@edk2.groups.io
Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Jiang, Guomin <guomin.jiang@intel.com>; Xu, Wei6 <wei6.xu@intel.com>
Subject: [edk2-devel] [PATCH v1 1/1] FmpDevicePkg/FmpDxe: Fix Clang build error

From: Michael Kubacki <michael.kubacki@microsoft.com>

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2887

The local Private pointer variable in SetTheImage() is initialized based on the caller provided This pointer argument. The cleanup label path uses the Private pointer which will not be initialized if This is NULL.

This change initializes Private to NULL and accounts for Private potentially being NULL in the cleanup label path.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
 FmpDevicePkg/FmpDxe/FmpDxe.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c index 854feec0a162..427b215ddc5f 100644
--- a/FmpDevicePkg/FmpDxe/FmpDxe.c
+++ b/FmpDevicePkg/FmpDxe/FmpDxe.c
@@ -1043,6 +1043,7 @@ SetTheImage (
   UINT32                            DependenciesSize;
 
   Status             = EFI_SUCCESS;
+  Private            = NULL;
   Updateable         = 0;
   BooleanValue       = FALSE;
   FmpHeaderSize      = 0;
@@ -1293,7 +1294,10 @@ SetTheImage (
 
 cleanup:
   mProgressFunc = NULL;
-  SetLastAttemptStatusInVariable (Private, LastAttemptStatus);
+
+  if (Private != NULL) {
+    SetLastAttemptStatusInVariable (Private, LastAttemptStatus);  }
 
   if (Progress != NULL) {
     //
@@ -1306,7 +1310,9 @@ SetTheImage (
   // Need repopulate after SetImage is called to
   // update LastAttemptVersion and LastAttemptStatus.
   //
-  Private->DescriptorPopulated = FALSE;
+  if (Private != NULL) {
+    Private->DescriptorPopulated = FALSE;  }
 
   return Status;
 }
--
2.28.0.windows.1





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH v1 1/1] FmpDevicePkg/FmpDxe: Fix Clang build error
  2020-08-12  0:23 [PATCH v1 1/1] FmpDevicePkg/FmpDxe: Fix Clang build error Michael Kubacki
  2020-08-12  1:07 ` [edk2-devel] " Liming Gao
@ 2020-08-12  7:04 ` Guomin Jiang
  1 sibling, 0 replies; 3+ messages in thread
From: Guomin Jiang @ 2020-08-12  7:04 UTC (permalink / raw)
  To: devel@edk2.groups.io, michael.kubacki@outlook.com
  Cc: Gao, Liming, Kinney, Michael D, Xu, Wei6

Reviewed-by: Guomin Jiang <guomin.jiang@intel.com>

Thanks
Guomin
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael
> Kubacki
> Sent: Wednesday, August 12, 2020 8:24 AM
> To: devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Jiang, Guomin <guomin.jiang@intel.com>;
> Xu, Wei6 <wei6.xu@intel.com>
> Subject: [edk2-devel] [PATCH v1 1/1] FmpDevicePkg/FmpDxe: Fix Clang build
> error
> 
> From: Michael Kubacki <michael.kubacki@microsoft.com>
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2887
> 
> The local Private pointer variable in SetTheImage() is initialized based on the
> caller provided This pointer argument. The cleanup label path uses the
> Private pointer which will not be initialized if This is NULL.
> 
> This change initializes Private to NULL and accounts for Private potentially
> being NULL in the cleanup label path.
> 
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Guomin Jiang <guomin.jiang@intel.com>
> Cc: Wei6 Xu <wei6.xu@intel.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> ---
>  FmpDevicePkg/FmpDxe/FmpDxe.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c
> b/FmpDevicePkg/FmpDxe/FmpDxe.c index 854feec0a162..427b215ddc5f
> 100644
> --- a/FmpDevicePkg/FmpDxe/FmpDxe.c
> +++ b/FmpDevicePkg/FmpDxe/FmpDxe.c
> @@ -1043,6 +1043,7 @@ SetTheImage (
>    UINT32                            DependenciesSize;
> 
>    Status             = EFI_SUCCESS;
> +  Private            = NULL;
>    Updateable         = 0;
>    BooleanValue       = FALSE;
>    FmpHeaderSize      = 0;
> @@ -1293,7 +1294,10 @@ SetTheImage (
> 
>  cleanup:
>    mProgressFunc = NULL;
> -  SetLastAttemptStatusInVariable (Private, LastAttemptStatus);
> +
> +  if (Private != NULL) {
> +    SetLastAttemptStatusInVariable (Private, LastAttemptStatus);  }
> 
>    if (Progress != NULL) {
>      //
> @@ -1306,7 +1310,9 @@ SetTheImage (
>    // Need repopulate after SetImage is called to
>    // update LastAttemptVersion and LastAttemptStatus.
>    //
> -  Private->DescriptorPopulated = FALSE;
> +  if (Private != NULL) {
> +    Private->DescriptorPopulated = FALSE;  }
> 
>    return Status;
>  }
> --
> 2.28.0.windows.1
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-12  7:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-12  0:23 [PATCH v1 1/1] FmpDevicePkg/FmpDxe: Fix Clang build error Michael Kubacki
2020-08-12  1:07 ` [edk2-devel] " Liming Gao
2020-08-12  7:04 ` Guomin Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox