Commit f90a21c8 authored by Dan Carpenter's avatar Dan Carpenter Committed by Linus Walleij

pinctrl: nsp: off by ones in nsp_pinmux_enable()

The > comparisons should be >= or else we read beyond the end of the
pinctrl->functions[] array.

Fixes: cc4fa83f ("pinctrl: nsp: add pinmux driver support for Broadcom NSP SoC")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarRay Jui <ray.jui@broadcom.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 550b6f7e
...@@ -460,8 +460,8 @@ static int nsp_pinmux_enable(struct pinctrl_dev *pctrl_dev, ...@@ -460,8 +460,8 @@ static int nsp_pinmux_enable(struct pinctrl_dev *pctrl_dev,
const struct nsp_pin_function *func; const struct nsp_pin_function *func;
const struct nsp_pin_group *grp; const struct nsp_pin_group *grp;
if (grp_select > pinctrl->num_groups || if (grp_select >= pinctrl->num_groups ||
func_select > pinctrl->num_functions) func_select >= pinctrl->num_functions)
return -EINVAL; return -EINVAL;
func = &pinctrl->functions[func_select]; func = &pinctrl->functions[func_select];
......
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