hw/gpio/aspeed_gpio: Avoid shift into sign bit
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 30 Aug 2024 18:05:16 +0000 (19:05 +0100)
committerCédric Le Goater <clg@redhat.com>
Mon, 16 Sep 2024 15:44:07 +0000 (17:44 +0200)
commit737cb2f3b21af83ab3e01d4f86e52c1c1afe3524
treedb9fc0f0e750e6f7378cdb20934ad6ad1200e0fa
parentea9cdbcf3a0b8d5497cddf87990f1b39d8f3bb0a
hw/gpio/aspeed_gpio: Avoid shift into sign bit

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.

Resolves: Coverity CID 1547742
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
hw/gpio/aspeed_gpio.c