[PATCH] efi_loader: convert void* to u8* on the tcg eventlog buffer

Ilias Apalodimas ilias.apalodimas at linaro.org
Mon Mar 29 15:59:55 CEST 2021


Although ptr arithmetics are allowed with extensions in gcc, they
are not allowed by the C spec.  So switch the 'void *' containing our
eventlog buffer into 'u8 *'

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

diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index 09046844c723..d5213586cb9c 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -23,8 +23,8 @@
 #include <hexdump.h>
 
 struct event_log_buffer {
-	void *buffer;
-	void *final_buffer;
+	u8 *buffer;
+	u8 *final_buffer;
 	size_t pos; /* eventlog position */
 	size_t final_pos; /* final events config table position */
 	size_t last_event_size;
@@ -990,12 +990,12 @@ static efi_status_t create_final_event(void)
 	 * EFI_CONFIGURATION_TABLE
 	 */
 	ret = efi_allocate_pool(EFI_ACPI_MEMORY_NVS, TPM2_EVENT_LOG_SIZE,
-				&event_log.final_buffer);
+				(void **)&event_log.final_buffer);
 	if (ret != EFI_SUCCESS)
 		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);
-- 
2.31.0



More information about the U-Boot mailing list