]> git.proxmox.com Git - mirror_edk2.git/commitdiff
FmpDevicePkg FmpDxe: Use local variable to store test key digest size
authorStar Zeng <star.zeng@intel.com>
Tue, 31 Jul 2018 02:25:49 +0000 (10:25 +0800)
committerKinney, Michael D <michael.d.kinney@intel.com>
Thu, 2 Aug 2018 21:46:19 +0000 (14:46 -0700)
Some static tool reports "the condition in 'if' statement is constant".

This patch updates the code to use local variable to store test key
digest size. It can pass the static tool's check.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
FmpDevicePkg/FmpDxe/DetectTestKey.c

index 6dedbdfaee28e0fbaf495736370b60c051bb801e..f9b983bb75ef905e3c7978ce2d4be4daec5192b0 100644 (file)
@@ -53,12 +53,14 @@ DetectTestKey (
   UINT8    *PublicKeyDataXdrEnd;\r
   VOID     *HashContext;\r
   UINT8    Digest[SHA256_DIGEST_SIZE];\r
   UINT8    *PublicKeyDataXdrEnd;\r
   VOID     *HashContext;\r
   UINT8    Digest[SHA256_DIGEST_SIZE];\r
+  UINTN    TestKeyDigestSize;\r
 \r
   //\r
   // If PcdFmpDeviceTestKeySha256Digest is not exacty SHA256_DIGEST_SIZE bytes,\r
   // then skip the test key detection.\r
   //\r
 \r
   //\r
   // If PcdFmpDeviceTestKeySha256Digest is not exacty SHA256_DIGEST_SIZE bytes,\r
   // then skip the test key detection.\r
   //\r
-  if (PcdGetSize (PcdFmpDeviceTestKeySha256Digest) != SHA256_DIGEST_SIZE) {\r
+  TestKeyDigestSize = PcdGetSize (PcdFmpDeviceTestKeySha256Digest);\r
+  if (TestKeyDigestSize != SHA256_DIGEST_SIZE) {\r
     return;\r
   }\r
 \r
     return;\r
   }\r
 \r