gpiolib: acpi: handle overflow check in acpi_gpio_adr_space_handler()
PATCH 1/1 gpiolib: acpi: handle overflow check in acpi_gpio_adr_space_handler()
Added an overflow check when setting a bit, since the function will not work correctly if there is an overflow.
Found by Linux Verification Center (linuxtesting.org) with svace.
Fixes dc62b56a68d3 ("gpio / ACPI: use *_cansleep version of gpiod_get/set APIs")
Signed-off-by Alexandr Sapozhnikov <[email protected]>
--- drivers/gpio/gpiolib-acpi.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpio/gpiolib-acpi.c +5 -0
@@ -1069,6 +1069,11 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,mutex_unlock (&achip->conn_lock); +if (i <0 || i >64 ) { + status=-EINVAL ; + goto out; + } +if (function ==ACPI_WRITE )gpiod_set_raw_value_cansleep (desc, !!((1 << i) & *value));
Signature · 1 line
2.51.0