aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew Fustini <[email protected]>2020-09-30 12:48:40 -0500
committerLinus Walleij <[email protected]>2020-10-01 10:02:45 +0200
commit9b9448f39e83d8e6fdfed006c5db8c304a98c2cd (patch)
treecde13856d308c97ad80d4b2f36ae6f9806df097e
parenta0cec28c965285c4debc00b035552f8096f2aee4 (diff)
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: a13395418888 ("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]>
-rw-r--r--drivers/pinctrl/pinctrl-single.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index efe41abc5d47..5cbf0e55087c 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1014,7 +1014,7 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
if (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",
pinctrl_spec.args_count);
break;