summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDu Lin <du.lin@intel.com>2024-03-12 10:54:30 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-03-15 10:20:24 +0000
commit3840c35e34d1c992268092b6366e26f2acc55a75 (patch)
tree19af0c78b70bed4e3c2a1de05bf62506e1c8e06c
parentccbbc2a5c84a0330b28b726ef0936fc16937005a (diff)
downloadedk2-3840c35e34d1c992268092b6366e26f2acc55a75.tar.gz
edk2-3840c35e34d1c992268092b6366e26f2acc55a75.tar.bz2
edk2-3840c35e34d1c992268092b6366e26f2acc55a75.zip
IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4701 The error handling of FspmWrapperInit() is limited to ASSERT statements only, which only works in debug builds, but not in release builds. Fix the issue by enhancing the error handling of FspmWrapperInit() to cover both debug builds and release builds. Cc: Ashraf Ali S <ashraf.ali.s@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: Chen Gang C <gang.c.chen@intel.com> Cc: Duggapu Chinni B <chinni.b.duggapu@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Susovan Mohapatra <susovan.mohapatra@intel.com> Cc: Ted Kuo <ted.kuo@intel.com> Signed-off-by: Du Lin <du.lin@intel.com> Reviewed-by: Ashraf Ali S <ashraf.ali.s@intel.com> Reviewed-by: Chen Gang C <gang.c.chen@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
-rw-r--r--IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
index ba0c742fea..7f1deb9542 100644
--- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
+++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
@@ -197,12 +197,20 @@ FspmWrapperInit (
MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi));
ASSERT (MeasurementExcludedFvPpi != NULL);
+ if (MeasurementExcludedFvPpi == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
MeasurementExcludedFvPpi->Count = 1;
MeasurementExcludedFvPpi->Fv[0].FvBase = PcdGet32 (PcdFspmBaseAddress);
MeasurementExcludedFvPpi->Fv[0].FvLength = ((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspmBaseAddress))->FvLength;
MeasurementExcludedPpiList = AllocatePool (sizeof (*MeasurementExcludedPpiList));
ASSERT (MeasurementExcludedPpiList != NULL);
+ if (MeasurementExcludedPpiList == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
MeasurementExcludedPpiList->Guid = &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid;
MeasurementExcludedPpiList->Ppi = MeasurementExcludedFvPpi;