Commit 9b9448f3 authored by Drew Fustini's avatar Drew Fustini Committed by Linus Walleij

pinctrl: single: fix pinctrl_spec.args_count bounds check

The property #pinctrl-cells can either be 1 or 2:

- if #pinctrl-cells = <1>, then pinctrl_spec.args_count = 2
- if #pinctrl-cells = <2>, then pinctrl_spec.args_count = 3

All other values of pinctrl_spec.args_count are incorrect.  This fix
checks the upper bound instead of just the lower bound.

Fixes: a1339541 ("pinctrl: single: parse #pinctrl-cells = 2")
Reported-by: default avatarTrent Piepho <tpiepho@gmail.com>
Signed-off-by: default avatarDrew Fustini <drew@beagleboard.org>
Acked-by: default avatarTony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/linux-omap/3139716.CMS8C0sQ7x@zen.local/
Link: https://lore.kernel.org/r/20200930174839.1308344-1-drew@beagleboard.orgSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent a0cec28c
...@@ -1014,7 +1014,7 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs, ...@@ -1014,7 +1014,7 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
if (res) if (res)
return res; return res;
if (pinctrl_spec.args_count < 2) { if (pinctrl_spec.args_count < 2 || pinctrl_spec.args_count > 3) {
dev_err(pcs->dev, "invalid args_count for spec: %i\n", dev_err(pcs->dev, "invalid args_count for spec: %i\n",
pinctrl_spec.args_count); pinctrl_spec.args_count);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment