]> git.proxmox.com Git - mirror_edk2.git/commitdiff
FmpDevicePkg/FmpDxe: Fix Clang build error
authorMichael Kubacki <michael.kubacki@microsoft.com>
Wed, 12 Aug 2020 00:23:57 +0000 (08:23 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 13 Aug 2020 07:09:15 +0000 (07:09 +0000)
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>
Tested-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Guomin Jiang <guomin.jiang@intel.com>
FmpDevicePkg/FmpDxe/FmpDxe.c

index 854feec0a162b1fce7a6af0f886a60331b543037..427b215ddc5f084516dfb53a8bace29be1cc2d2c 100644 (file)
@@ -1043,6 +1043,7 @@ SetTheImage (
   UINT32                            DependenciesSize;\r
 \r
   Status             = EFI_SUCCESS;\r
+  Private            = NULL;\r
   Updateable         = 0;\r
   BooleanValue       = FALSE;\r
   FmpHeaderSize      = 0;\r
@@ -1293,7 +1294,10 @@ SetTheImage (
 \r
 cleanup:\r
   mProgressFunc = NULL;\r
-  SetLastAttemptStatusInVariable (Private, LastAttemptStatus);\r
+\r
+  if (Private != NULL) {\r
+    SetLastAttemptStatusInVariable (Private, LastAttemptStatus);\r
+  }\r
 \r
   if (Progress != NULL) {\r
     //\r
@@ -1306,7 +1310,9 @@ cleanup:
   // Need repopulate after SetImage is called to\r
   // update LastAttemptVersion and LastAttemptStatus.\r
   //\r
-  Private->DescriptorPopulated = FALSE;\r
+  if (Private != NULL) {\r
+    Private->DescriptorPopulated = FALSE;\r
+  }\r
 \r
   return Status;\r
 }\r