Re: [PATCH] hw/gpio/aspeed_gpio: Avoid shift into sign bit

2024-09-01 Thread Cédric Le Goater
On 8/30/24 20:05, Peter Maydell wrote: In aspeed_gpio_update() we calculate "mask = 1 << gpio", where gpio can be between 0 and 31. Coverity complains about this because 1 << 31 won't fit in a signed integer. For QEMU this isn't an error because we enable -fwrapv, but we can keep Coverity happy

[PATCH] hw/gpio/aspeed_gpio: Avoid shift into sign bit

2024-08-30 Thread Peter Maydell
In aspeed_gpio_update() we calculate "mask = 1 << gpio", where gpio can be between 0 and 31. Coverity complains about this because 1 << 31 won't fit in a signed integer. For QEMU this isn't an error because we enable -fwrapv, but we can keep Coverity happy by doing the shift on unsigned numbers.