[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191008114559.GD25098@kadam>
Date: Tue, 8 Oct 2019 14:46:37 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Colin King <colin.king@...onical.com>,
Jerry Snitselaar <jsnitsel@...hat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Ingo Molnar <mingo@...nel.org>, linux-efi@...r.kernel.org,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] efi/tpm: fix sanity check of unsigned tbl_size
being less than zero
On Tue, Oct 08, 2019 at 11:01:53AM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> 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")
> Fixes: e658c82be556 ("efi/tpm: Only set 'efi_tpm_final_log_size' after successful event log parsing")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
> 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 703469c1ab8e..ebd7977653a8 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;
Do we need to do a "ret = tbl_size;"? Currently we return success.
It's a pitty that tpm2_calc_event_log_size() returns a -1 instead of
-EINVAL.
regards,
dan carpenter
Powered by blists - more mailing lists