summaryrefslogtreecommitdiff
path: root/IntelFsp2WrapperPkg/FspmWrapperPeim
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2016-06-30 09:13:24 +0800
committerHao Wu <hao.a.wu@intel.com>2016-07-05 11:17:40 +0800
commitf4580d90ac9f8b8f65289c394d03bdd0689f0a9e (patch)
tree14c95ccd09b1a16809fcf6c5dc6505fa01b92134 /IntelFsp2WrapperPkg/FspmWrapperPeim
parentecb881be9723e98017aa3a87231578e574cba136 (diff)
downloadedk2-platforms-f4580d90ac9f8b8f65289c394d03bdd0689f0a9e.tar.xz
IntelFsp2WrapperPkg: Add error handling for possible NULL ptr dereference
Possible NULL pointer dereference for FspmHeaderPtr/FspsHeaderPtr in module FspmWrapperPeim/FspsWrapperPeim. Add error handling codes to avoid this issue. Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com> (cherry picked from commit 599c45ff0b2bbc53a4ee3d82aab46c2cf3c78889)
Diffstat (limited to 'IntelFsp2WrapperPkg/FspmWrapperPeim')
-rw-r--r--IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
index 6144ad7f41..c98513e41b 100644
--- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
+++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
@@ -68,6 +68,11 @@ PeiFspMemoryInit (
// Copy default FSP-M UPD data from Flash
//
FspmHeaderPtr = (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspmBaseAddress));
+ DEBUG ((DEBUG_INFO, "FspmHeaderPtr - 0x%x\n", FspmHeaderPtr));
+ if (FspmHeaderPtr == NULL) {
+ return EFI_DEVICE_ERROR;
+ }
+
FspmUpdDataPtr = (FSPM_UPD_COMMON *)AllocateZeroPool ((UINTN)FspmHeaderPtr->CfgRegionSize);
ASSERT (FspmUpdDataPtr != NULL);
SourceData = (UINTN *)((UINTN)FspmHeaderPtr->ImageBase + (UINTN)FspmHeaderPtr->CfgRegionOffset);