Skip to contentSkip to conversation

gpio: Fix range check in of_gpio_simple_xlate()

PATCH New Roland Stigge 2 participants 3 messages Apr 4, 2012 – Apr 7, 2012 Device tree

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: Fix range check in of_gpio_simple_xlate()

This patch fixes a range check in of_gpio_simple_xlate() by replacing a "> gc->ngpio" with ">= gc->ngpio" since range is from 0 to gc->ngpio - 1

---

Applies to v3.4-rc1

 drivers/of/gpio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/gpio.c +1 -1
@@ -140,7 +140,7 @@ int of_gpio_simple_xlate(struct gpio_chi
 	if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells))
 		return -EINVAL;
 
-	if (gpiospec->args[0] > gc->ngpio)
+	if (gpiospec->args[0] >= gc->ngpio)
 		return -EINVAL;
 
 	if (flags)
#1 lore raw

PATCH 1/1 gpio: Fix range check in of_gpio_simple_xlate()

Quoted 4 lines · Roland Stigge

This patch fixes a range check in of_gpio_simple_xlate() by replacing a "> gc->ngpio" with ">= gc->ngpio" since range is from 0 to gc->ngpio - 1

CC stable at vger.kernel.org
Applied
#2 lore raw

PATCH 1/1 gpio: Fix range check in of_gpio_simple_xlate()

In reply to Roland Stigge
Quoted 4 lines · Roland Stigge

This patch fixes a range check in of_gpio_simple_xlate() by replacing a "> gc->ngpio" with ">= gc->ngpio" since range is from 0 to gc->ngpio - 1

Applied, thanks.

g.

Quoted 19 lines

---

Applies to v3.4-rc1

 drivers/of/gpio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/gpio.c +1 -1
@@ -140,7 +140,7 @@ int of_gpio_simple_xlate(struct gpio_chi
 	if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells))
 		return -EINVAL;
 
-	if (gpiospec->args[0] > gc->ngpio)
+	if (gpiospec->args[0] >= gc->ngpio)
 		return -EINVAL;
 
 	if (flags)
Signature · 2 lines
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies,Ltd.