[tip: efi/urgent] efi/tpm: Fix sanity check of unsigned tbl_size being less than zero
From: tip-bot2 for Colin Ian King
Date: Tue Oct 08 2019 - 07:05:27 EST
The following commit has been merged into the efi/urgent branch of tip:
Commit-ID: be59d57f98065af0b8472f66a0a969207b168680
Gitweb: https://git.kernel.org/tip/be59d57f98065af0b8472f66a0a969207b168680
Author: Colin Ian King <colin.king@xxxxxxxxxxxxx>
AuthorDate: Tue, 08 Oct 2019 11:01:53 +01:00
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitterDate: Tue, 08 Oct 2019 13:01:09 +02:00
efi/tpm: Fix sanity check of unsigned tbl_size being less than zero
Currently the check for tbl_size being less than zero is always false
because tbl_size is unsigned. Fix this by making it a signed int.
Addresses-Coverity: ("Unsigned compared against 0")
Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
Cc: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
Cc: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: kernel-janitors@xxxxxxxxxxxxxxx
Cc: linux-efi@xxxxxxxxxxxxxxx
Fixes: e658c82be556 ("efi/tpm: Only set 'efi_tpm_final_log_size' after successful event log parsing")
Link: https://lkml.kernel.org/r/20191008100153.8499-1-colin.king@xxxxxxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
drivers/firmware/efi/tpm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c
index 703469c..ebd7977 100644
--- a/drivers/firmware/efi/tpm.c
+++ b/drivers/firmware/efi/tpm.c
@@ -40,7 +40,7 @@ int __init efi_tpm_eventlog_init(void)
{
struct linux_efi_tpm_eventlog *log_tbl;
struct efi_tcg2_final_events_table *final_tbl;
- unsigned int tbl_size;
+ int tbl_size;
int ret = 0;
if (efi.tpm_log == EFI_INVALID_TABLE_ADDR) {