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

ivanhu ivan.hu at canonical.com
Thu Jan 25 02:34:01 UTC 2018



On 01/24/2018 11:12 PM, 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: Ivan Hu <ivan.hu at canonical.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/fwts-devel/attachments/20180125/3f7e4cd6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/fwts-devel/attachments/20180125/3f7e4cd6/attachment.sig>


More information about the fwts-devel mailing list