[PATCH] efi_loader: Change the return values if a TPM is missing during GetEventLog

Ilias Apalodimas ilias.apalodimas at linaro.org
Fri Jul 3 14:46:35 CEST 2026


The function defined by the TCG spec looks like:

typedef
EFI_STATUS
(EFIAPI *EFI_TCG2_GET_EVENT_LOG) (
 IN EFI_TCG2_PROTOCOL *This,
 IN EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat,
 OUT EFI_PHYSICAL_ADDRESS *EventLogLocation,
 OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry,
 OUT BOOLEAN *EventLogTruncated
);
and the spec mandates that
"If no TPM is present, the function SHALL set the following values and return
	EFI_SUCCESS:
	EventLogLocation = NULL
	EventLogLastEntry = NULL
	EventLogTruncated = FALSE"

However, if we set it to NULL the local assignment is discarded when the
function returns. Set it to 0, although on some platforms that's a valid
address.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
---
 lib/efi_loader/efi_tcg2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index 1d52a04ca48f..07637df7660b 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -352,8 +352,8 @@ efi_tcg2_get_eventlog(struct efi_tcg2_protocol *this,
 	}
 
 	if (tcg2_platform_get_tpm2(&dev)) {
-		event_log_location = NULL;
-		event_log_last_entry = NULL;
+		*event_log_location = 0;
+		*event_log_last_entry = 0;
 		*event_log_truncated = false;
 		ret = EFI_SUCCESS;
 		goto out;
-- 
2.53.0



More information about the U-Boot mailing list