diff options
author | Hao Wu <hao.a.wu@intel.com> | 2016-06-30 09:13:24 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-07-01 08:50:39 +0800 |
commit | 599c45ff0b2bbc53a4ee3d82aab46c2cf3c78889 (patch) | |
tree | d7e62a7c027a0901ca1be04eeaffa31d6f2ef73d /IntelFsp2WrapperPkg/FspsWrapperPeim | |
parent | 42cb906852753a081b8458c7f8742e74eeadefd3 (diff) | |
download | edk2-599c45ff0b2bbc53a4ee3d82aab46c2cf3c78889.tar.gz |
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>
Diffstat (limited to 'IntelFsp2WrapperPkg/FspsWrapperPeim')
-rw-r--r-- | IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c index 7a65ad7f61..c9236908c8 100644 --- a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c +++ b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c @@ -241,6 +241,11 @@ PeiMemoryDiscoveredNotify ( // Copy default FSP-S UPD data from Flash
//
FspsHeaderPtr = (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspsBaseAddress));
+ DEBUG ((DEBUG_INFO, "FspsHeaderPtr - 0x%x\n", FspsHeaderPtr));
+ if (FspsHeaderPtr == NULL) {
+ return EFI_DEVICE_ERROR;
+ }
+
FspsUpdDataPtr = (FSPS_UPD_COMMON *)AllocateZeroPool ((UINTN)FspsHeaderPtr->CfgRegionSize);
ASSERT (FspsUpdDataPtr != NULL);
SourceData = (UINTN *)((UINTN)FspsHeaderPtr->ImageBase + (UINTN)FspsHeaderPtr->CfgRegionOffset);
|