diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2018-07-03 15:04:25 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2018-07-14 12:47:04 +0200 |
commit | f90a21c898db58eaea14b8ad7e9af3b9e15e5f8a (patch) | |
tree | 9b5632dad65256452c2ceb4f9c4edb4c599fe014 /drivers/pinctrl/bcm | |
parent | 550b6f7e8cf93fc2753aa01e655ed5471012ab5a (diff) |
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: cc4fa83f66e9 ("pinctrl: nsp: add pinmux driver support for Broadcom NSP SoC")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/bcm')
-rw-r--r-- | drivers/pinctrl/bcm/pinctrl-nsp-mux.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pinctrl/bcm/pinctrl-nsp-mux.c b/drivers/pinctrl/bcm/pinctrl-nsp-mux.c index 35c17653c694..5cd8166fbbc8 100644 --- a/drivers/pinctrl/bcm/pinctrl-nsp-mux.c +++ b/drivers/pinctrl/bcm/pinctrl-nsp-mux.c @@ -460,8 +460,8 @@ static int nsp_pinmux_enable(struct pinctrl_dev *pctrl_dev, const struct nsp_pin_function *func; const struct nsp_pin_group *grp; - if (grp_select > pinctrl->num_groups || - func_select > pinctrl->num_functions) + if (grp_select >= pinctrl->num_groups || + func_select >= pinctrl->num_functions) return -EINVAL; func = &pinctrl->functions[func_select]; |