[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220411063324.98542-1-andrei.lalaev@emlid.com>
Date: Mon, 11 Apr 2022 09:33:25 +0300
From: Andrei Lalaev <andrei.lalaev@...id.com>
To: linus.walleij@...aro.org, brgl@...ev.pl
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Andrei Lalaev <andrei.lalaev@...id.com>
Subject: [PATCH] gpiolib: of: fix bounds check for valid mask
Use "greater" instead of "greater or equal" when performs bounds check
to make sure that GPIOS are in available range. Previous implementation
skipped ranges which include last GPIO in range.
Signed-off-by: Andrei Lalaev <andrei.lalaev@...id.com>
---
drivers/gpio/gpiolib-of.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index ae1ce319cd78..7e5e51d49d09 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -910,7 +910,7 @@ static void of_gpiochip_init_valid_mask(struct gpio_chip *chip)
i, &start);
of_property_read_u32_index(np, "gpio-reserved-ranges",
i + 1, &count);
- if (start >= chip->ngpio || start + count >= chip->ngpio)
+ if (start >= chip->ngpio || start + count > chip->ngpio)
continue;
bitmap_clear(chip->valid_mask, start, count);
--
2.25.1
Powered by blists - more mailing lists