[PATCH] efi_loader: fix FinalEvent table initial position
Ilias Apalodimas
ilias.apalodimas at linaro.org
Wed Nov 17 00:24:07 CET 2021
When initializing the final event table in create_final_event() we are
setting the initial buffer position to sizeof(*final_event). Although
we clear the buffer correctly and won't cause any problems, we should
start logging events starting from zero.
While at it add a cast when defining the final_event.
Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
---
lib/efi_loader/efi_tcg2.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index 189e4a5ba59c..634556342a7c 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -1257,10 +1257,11 @@ static efi_status_t create_final_event(void)
goto out;
memset(event_log.final_buffer, 0xff, TPM2_EVENT_LOG_SIZE);
- final_event = event_log.final_buffer;
+ final_event =
+ (struct efi_tcg2_final_events_table *)event_log.final_buffer;
final_event->number_of_events = 0;
final_event->version = EFI_TCG2_FINAL_EVENTS_TABLE_VERSION;
- event_log.final_pos = sizeof(*final_event);
+ event_log.final_pos = 0;
ret = efi_install_configuration_table(&efi_guid_final_events,
final_event);
if (ret != EFI_SUCCESS) {
--
2.33.1
More information about the U-Boot
mailing list