diff options
author | Gregory Price <gourry@gourry.net> | 2024-09-14 01:19:53 +0200 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2024-10-15 20:27:29 +0200 |
commit | a066397e8ed1036e8b959050ab6e830ee90d9f58 (patch) | |
tree | b04c8fb1030b4478688e302815729d265d3b55a9 /drivers/firmware/efi | |
parent | tpm: do not ignore memblock_reserve return value (diff) | |
download | linux-a066397e8ed1036e8b959050ab6e830ee90d9f58.tar.xz linux-a066397e8ed1036e8b959050ab6e830ee90d9f58.zip |
tpm: fix unsigned/signed mismatch errors related to __calc_tpm2_event_size
__calc_tpm2_event_size returns 0 or a positive length, but return values
are often interpreted as ints. Convert everything over to u32 to avoid
signed/unsigned logic errors.
Signed-off-by: Gregory Price <gourry@gourry.net>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi')
-rw-r--r-- | drivers/firmware/efi/libstub/tpm.c | 6 | ||||
-rw-r--r-- | drivers/firmware/efi/tpm.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libstub/tpm.c index 1fd6823248ab..d31ea3f351d8 100644 --- a/drivers/firmware/efi/libstub/tpm.c +++ b/drivers/firmware/efi/libstub/tpm.c @@ -57,7 +57,7 @@ static void efi_retrieve_tcg2_eventlog(int version, efi_physical_addr_t log_loca struct linux_efi_tpm_eventlog *log_tbl = NULL; unsigned long first_entry_addr, last_entry_addr; size_t log_size, last_entry_size; - int final_events_size = 0; + u32 final_events_size = 0; first_entry_addr = (unsigned long) log_location; @@ -110,9 +110,9 @@ static void efi_retrieve_tcg2_eventlog(int version, efi_physical_addr_t log_loca */ if (final_events_table && final_events_table->nr_events) { struct tcg_pcr_event2_head *header; - int offset; + u32 offset; void *data; - int event_size; + u32 event_size; int i = final_events_table->nr_events; data = (void *)final_events_table; diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c index b0cc2cc11d7e..cdd431027065 100644 --- a/drivers/firmware/efi/tpm.c +++ b/drivers/firmware/efi/tpm.c @@ -19,7 +19,7 @@ EXPORT_SYMBOL(efi_tpm_final_log_size); static int __init tpm2_calc_event_log_size(void *data, int count, void *size_info) { struct tcg_pcr_event2_head *header; - int event_size, size = 0; + u32 event_size, size = 0; while (count > 0) { header = data + size; |