提交 6270d830 编写于 作者: R Roland Stigge 提交者: Grant Likely

gpio: Fix range check in of_gpio_simple_xlate()

of_gpio_simple_xlate() has an off-by-one bug where it checks to see if
args[0] is > ngpio instead of >=.  args[0] must always be less than
ngpio because it is a zero-based enumeration.
Signed-off-by: NRoland Stigge <stigge@antcom.de>
[grant.likely: beef up commit text]
Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
上级 078dc65e
......@@ -140,7 +140,7 @@ int of_gpio_simple_xlate(struct gpio_chip *gc,
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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册