mirror of https://github.com/acidanthera/audk.git
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>
This commit is contained in:
parent
42cb906852
commit
599c45ff0b
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue