From ccbbc2a5c84a0330b28b726ef0936fc16937005a Mon Sep 17 00:00:00 2001 From: Du Lin Date: Tue, 12 Mar 2024 10:30:06 +0800 Subject: [PATCH] IntelFsp2WrapperPkg: Error handling of TpmMeasureAndLogDataWithFlags() REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4700 TpmMeasureAndLogDataWithFlags() computes the measure the code and log it into PCR 0. TpmMeasureAndLogData() computes the hash for the configuration. The same "Status" variable is used to store the return values for both of the functions. There is no error handling if TpmMeasureAndLogDataWithFlags() returns an error Status. Fix the issue by adding error handling for TpmMeasureAndLogDataWithFlags(). 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 Signed-off-by: Du Lin Reviewed-by: Ashraf Ali S Reviewed-by: Chen Gang C --- .../Library/BaseFspMeasurementLib/FspMeasurementLib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c b/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c index 2c017a4250..228277649b 100644 --- a/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c +++ b/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c @@ -197,6 +197,10 @@ MeasureFspFirmwareBlobWithCfg ( (UINTN)sizeof (DigestList), EDKII_TCG_PRE_HASH_LOG_ONLY ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "TpmMeasureAndLogDataWithFlags failed - %r\n", Status)); + return Status; + } Status = TpmMeasureAndLogData ( 1,