ACK: [PATCH] acpi: erst: cast size to uint64_t to clean up static analysis warning

Alex Hung alex.hung at canonical.com
Wed Jan 24 18:46:03 UTC 2018


On 2018-01-24 07:12 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> CoverityScan warns of a possible integer overflow (which is very
> unlikely to happen) when multiplying 32 bit integers.  Cast the
> first to the same type of variable total_length to clear up this
> warning.
> 
> Detected by CoverityScan, CID#1385375 ("Unintentional integer overflow")
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/acpi/erst/erst.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/acpi/erst/erst.c b/src/acpi/erst/erst.c
> index b9fe89e3..8ba611b7 100644
> --- a/src/acpi/erst/erst.c
> +++ b/src/acpi/erst/erst.c
> @@ -68,7 +68,7 @@ static int erst_test1(fwts_framework *fw)
>   			table->length);
>   		goto done;
>   	}
> -	total_length = (sizeof(fwts_acpi_serialization_instruction_entries) *
> +	total_length = ((uint64_t)sizeof(fwts_acpi_serialization_instruction_entries) *
>   		erst->instruction_entry_count) + sizeof(fwts_acpi_table_erst);
>   	if (total_length > table->length) {
>   		passed = false;
> 


Acked-by: Alex Hung <alex.hung at canonical.com>



More information about the fwts-devel mailing list