Skip to content

Commit 9b9448f

Browse files
pdp7linusw
authored andcommitted
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: a133954 ("pinctrl: single: parse #pinctrl-cells = 2") Reported-by: Trent Piepho <[email protected]> Signed-off-by: Drew Fustini <[email protected]> Acked-by: Tony Lindgren <[email protected]> Link: https://lore.kernel.org/linux-omap/[email protected]/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent a0cec28 commit 9b9448f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pinctrl/pinctrl-single.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
10141014
if (res)
10151015
return res;
10161016

1017-
if (pinctrl_spec.args_count < 2) {
1017+
if (pinctrl_spec.args_count < 2 || pinctrl_spec.args_count > 3) {
10181018
dev_err(pcs->dev, "invalid args_count for spec: %i\n",
10191019
pinctrl_spec.args_count);
10201020
break;

0 commit comments

Comments
 (0)