@@ -112,6 +112,22 @@ void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg)
log_size = log_last_entry - log_location + last_entry_size;
}
+ if (log_size == 0) {
+ efi_printk(sys_table_arg, "log_size == 0\n");
+ }
+ else if (log_size < 1 * 1024 * 1024) {
+ efi_printk(sys_table_arg, "log_size < 1M\n");
+ }
+ else if (log_size < 500 * 1024 * 1024) {
+ efi_printk(sys_table_arg, "log_size < 500M\n");
+ }
+ else if (log_size < 1000 * 1024 * 1024) {
+ efi_printk(sys_table_arg, "log_size < 1G\n");
+ }
+ else {
+ efi_printk(sys_table_arg, "log_size > 1G\n");
+ }
+
efi_printk(sys_table_arg, "Allocating memory for storing the logs\n");
/* Allocate space for the logs and copy them. */
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
@@ -124,6 +140,11 @@ void efi_retrieve_tpm2_eventlog_1_2(efi_system_table_t *sys_table_arg)
"Unable to allocate memory for event log\n");
return;
}
+ if (!log_tbl) {
+ efi_printk(sys_table_arg, "Pointer returned from allocation is NULL!\n");
+ return;
+ }
+
efi_printk(sys_table_arg, "Copying log to new location\n");
memset(log_tbl, 0, sizeof(*log_tbl) + log_size);