ACK: [PATCH] acpi: crsdump: fix portability warning from cppcheck

Alex Hung alex.hung at canonical.com
Wed May 13 01:13:21 UTC 2020


On 2020-05-12 6:54 p.m., Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> cppcheck detected an implementation defined behaviour issue,
> fix this by making 1 an unsigned integer value before shifing
> it.
> 
> src/acpi/crsdump/crsdump.c:321:17: portability: Shifting signed
> 32-bit value by 31 bits is implementation-defined behaviour
> [shiftTooManyBitsSigned]
> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  src/acpi/crsdump/crsdump.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/acpi/crsdump/crsdump.c b/src/acpi/crsdump/crsdump.c
> index 5c68f802..86f8b016 100644
> --- a/src/acpi/crsdump/crsdump.c
> +++ b/src/acpi/crsdump/crsdump.c
> @@ -318,7 +318,7 @@ static const char *crs_irq_map(const uint64_t val)
>  		unsigned int i;
>  
>  		for (i = 0; i < 32; i++) {
> -			if (val & (1 << i)) {
> +			if (val & (1UL << i)) {
>  				char tmp[5];
>  
>  				snprintf(tmp, sizeof(tmp), " %u", i);
> 

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



More information about the fwts-devel mailing list