summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2016-06-12 12:45:09 +0800
committerStar Zeng <star.zeng@intel.com>2016-06-13 16:04:22 +0800
commitd6f38e374ece00f1f8176007c9d3e8eff1f2308f (patch)
tree2ce70c4ba1817095a4c24f69e74b03c358df3f26 /MdeModulePkg
parent3900a7437edcff46ef7137d45b15587da8cfde1d (diff)
downloadedk2-d6f38e374ece00f1f8176007c9d3e8eff1f2308f.tar.gz
edk2-d6f38e374ece00f1f8176007c9d3e8eff1f2308f.tar.bz2
edk2-d6f38e374ece00f1f8176007c9d3e8eff1f2308f.zip
MdeModulePkg DxeS3BootScriptLib: Check (mSmst != NULL) before freeing SMRAM
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>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c
index f6de986e08..0ff73211ac 100644
--- a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c
+++ b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c
@@ -624,7 +624,7 @@ S3BootScriptLibDeinitialize (
Status = PcdSet64S (PcdS3BootScriptTablePrivateDataPtr, 0);
ASSERT_EFI_ERROR (Status);
}
- if (mS3BootScriptTableSmmAllocated) {
+ if ((mSmst != NULL) && mS3BootScriptTableSmmAllocated) {
Status = mSmst->SmmFreePool (mS3BootScriptTableSmmPtr);
ASSERT_EFI_ERROR (Status);
Status = PcdSet64S (PcdS3BootScriptTablePrivateSmmDataPtr, 0);