MdeModulePkg DxeS3BootScriptLib: Check (mSmst != NULL) before freeing SMRAM
authorStar Zeng <star.zeng@intel.com>
Sun, 12 Jun 2016 04:45:09 +0000 (12:45 +0800)
committerStar Zeng <star.zeng@intel.com>
Mon, 13 Jun 2016 08:04:22 +0000 (16:04 +0800)
There is static scan tool reports BootScriptSave.c:628:'mSmst' is
explicitly dereferenced.

The patch is to check (mSmst != NULL) before freeing SMRAM at
BootScriptSave.c:628.

Cc: Shumin Qiu <shumin.qiu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Shumin Qiu <shumin.qiu@intel.com>
MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c

index f6de986e0852537ce2616566920d378331550560..0ff73211acc44a7de6aba29bc45485bca3a1b761 100644 (file)
@@ -624,7 +624,7 @@ S3BootScriptLibDeinitialize (
     Status = PcdSet64S (PcdS3BootScriptTablePrivateDataPtr, 0);\r
     ASSERT_EFI_ERROR (Status);\r
   }\r
-  if (mS3BootScriptTableSmmAllocated) {\r
+  if ((mSmst != NULL) && mS3BootScriptTableSmmAllocated) {\r
     Status = mSmst->SmmFreePool (mS3BootScriptTableSmmPtr);\r
     ASSERT_EFI_ERROR (Status);\r
     Status = PcdSet64S (PcdS3BootScriptTablePrivateSmmDataPtr, 0);\r