pinctrl: nsp: off by ones in nsp_pinmux_enable()

[ Upstream commit f90a21c898 ]

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

Fixes: cc4fa83f66 ("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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Dan Carpenter 2018-07-03 15:04:25 +03:00 коммит произвёл Greg Kroah-Hartman
Родитель 87011fb97f
Коммит 54046f1793
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -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];