Re: [edk2-devel] [PATCH] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()
This patch has been updated to address Ray's comment. For more details, please check [PATCH v2] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit() (groups.io) ( https://edk2.groups.io/g/devel/message/116723 ). Thanks Ray for the comment. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116725): https://edk2.groups.io/g/devel/message/116725 Mute This Topic: https://groups.io/mt/104886876/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()
> - ASSERT (MeasurementExcludedFvPpi != NULL); > + if (MeasurementExcludedFvPpi == NULL) { > +ASSERT (FALSE); I prefer the original meaningful assertion instead of ASSERT (FALSE). Adding if-check is a good change to me. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116713): https://edk2.groups.io/g/devel/message/116713 Mute This Topic: https://groups.io/mt/104886876/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()
Reviewed-by: S, Ashraf Ali Thanks., S, Ashraf Ali -Original Message- From: Lin, Du Sent: Tuesday, March 12, 2024 2:58 PM To: devel@edk2.groups.io Cc: Lin, Du ; S, Ashraf Ali ; Chiu, Chasel ; Chen, Gang C ; Duggapu, Chinni B ; Desimone, Nathaniel L ; Zeng, Star ; Mohapatra, Susovan ; Kuo, Ted Subject: [PATCH] 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. Signed-off-by: Du Lin Cc: Ashraf Ali S Cc: Chasel Chiu Cc: Chen Gang C Cc: Duggapu Chinni B Cc: Nate DeSimone Cc: Star Zeng Cc: Susovan Mohapatra Cc: Ted Kuo --- .../FspmWrapperPeim/FspmWrapperPeim.c| 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c index ba0c742fea..356baeeccf 100644 --- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c +++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c @@ -196,13 +196,21 @@ FspmWrapperInit ( EFI_PEI_PPI_DESCRIPTOR *MeasurementExcludedPpiList; MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi)); - ASSERT (MeasurementExcludedFvPpi != NULL); + if (MeasurementExcludedFvPpi == NULL) { +ASSERT (FALSE); +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) { +ASSERT (FALSE); +return EFI_OUT_OF_RESOURCES; + } + MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; MeasurementExcludedPpiList->Guid = MeasurementExcludedPpiList->Ppi = MeasurementExcludedFvPpi; -- 2.44.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116707): https://edk2.groups.io/g/devel/message/116707 Mute This Topic: https://groups.io/mt/104886876/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] IntelFsp2WrapperPkg: Error handling of FspmWrapperInit()
Reviewed-by: Chen Gang C BR Gang -Original Message- From: Lin, Du Sent: Tuesday, March 12, 2024 5:28 PM To: devel@edk2.groups.io Cc: Lin, Du ; S, Ashraf Ali ; Chiu, Chasel ; Chen, Gang C ; Duggapu, Chinni B ; Desimone, Nathaniel L ; Zeng, Star ; Mohapatra, Susovan ; Kuo, Ted Subject: [PATCH] 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. Signed-off-by: Du Lin Cc: Ashraf Ali S Cc: Chasel Chiu Cc: Chen Gang C Cc: Duggapu Chinni B Cc: Nate DeSimone Cc: Star Zeng Cc: Susovan Mohapatra Cc: Ted Kuo --- .../FspmWrapperPeim/FspmWrapperPeim.c| 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c index ba0c742fea..356baeeccf 100644 --- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c +++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c @@ -196,13 +196,21 @@ FspmWrapperInit ( EFI_PEI_PPI_DESCRIPTOR *MeasurementExcludedPpiList; MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi)); - ASSERT (MeasurementExcludedFvPpi != NULL); + if (MeasurementExcludedFvPpi == NULL) { +ASSERT (FALSE); +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) { +ASSERT (FALSE); +return EFI_OUT_OF_RESOURCES; + } + MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; MeasurementExcludedPpiList->Guid = MeasurementExcludedPpiList->Ppi = MeasurementExcludedFvPpi; -- 2.44.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116699): https://edk2.groups.io/g/devel/message/116699 Mute This Topic: https://groups.io/mt/104886876/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH] 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. Signed-off-by: Du Lin Cc: Ashraf Ali S Cc: Chasel Chiu Cc: Chen Gang C Cc: Duggapu Chinni B Cc: Nate DeSimone Cc: Star Zeng Cc: Susovan Mohapatra Cc: Ted Kuo --- .../FspmWrapperPeim/FspmWrapperPeim.c| 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c index ba0c742fea..356baeeccf 100644 --- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c +++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c @@ -196,13 +196,21 @@ FspmWrapperInit ( EFI_PEI_PPI_DESCRIPTOR *MeasurementExcludedPpiList; MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi)); - ASSERT (MeasurementExcludedFvPpi != NULL); + if (MeasurementExcludedFvPpi == NULL) { +ASSERT (FALSE); +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) { +ASSERT (FALSE); +return EFI_OUT_OF_RESOURCES; + } + MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; MeasurementExcludedPpiList->Guid = MeasurementExcludedPpiList->Ppi = MeasurementExcludedFvPpi; -- 2.44.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116686): https://edk2.groups.io/g/devel/message/116686 Mute This Topic: https://groups.io/mt/104886876/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-