提交 f90a21c8 编写于 作者: D Dan Carpenter 提交者: 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: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NRay Jui <ray.jui@broadcom.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 550b6f7e
......@@ -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];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册