pinctrl: ns2: Fix off by one bugs in ns2_pinmux_enable()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 26 Sep 2019 08:14:26 +0000 (11:14 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 Nov 2019 10:27:17 +0000 (11:27 +0100)
commitf0eabc9e9acb68122bfb1e0321b13032ab20f2f3
tree9c34c61fb8356660706d2817558ef45a05cb6dfc
parent9a5d5ffb32459f43a5c1a02f7a628bd75e8a7ae6
pinctrl: ns2: Fix off by one bugs in ns2_pinmux_enable()

[ Upstream commit 39b65fbb813089e366b376bd8acc300b6fd646dc ]

The pinctrl->functions[] array has pinctrl->num_functions elements and
the pinctrl->groups[] array is the same way.  These are set in
ns2_pinmux_probe().  So the > comparisons should be >= so that we don't
read one element beyond the end of the array.

Fixes: b5aa1006e4a9 ("pinctrl: ns2: add pinmux driver support for Broadcom NS2 SoC")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20190926081426.GB2332@mwanda
Acked-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/bcm/pinctrl-ns2-mux.c