All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: sunxi: Fix off-by-one for valid offset range checking
@ 2013-08-30  8:31 Axel Lin
  2013-08-30  8:37 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2013-08-30  8:31 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Maxime Ripard, linux-kernel

The valid offset range should be 0 ... chip->ngpio - 1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/pinctrl/pinctrl-sunxi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c
index b20df31..0ffd4c0 100644
--- a/drivers/pinctrl/pinctrl-sunxi.c
+++ b/drivers/pinctrl/pinctrl-sunxi.c
@@ -529,7 +529,7 @@ static int sunxi_pinctrl_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 	struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev);
 	struct sunxi_desc_function *desc;
 
-	if (offset > chip->ngpio)
+	if (offset >= chip->ngpio)
 		return -ENXIO;
 
 	desc = sunxi_pinctrl_desc_find_function_by_pin(pctl, offset, "irq");
-- 
1.8.1.2




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-30  8:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-30  8:31 [PATCH] pinctrl: sunxi: Fix off-by-one for valid offset range checking Axel Lin
2013-08-30  8:37 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.