Skip to content

Commit 73c4707

Browse files
Dan Carpentergregkh
authored andcommitted
pinctrl: tegra: Fix off by one in tegra_pinctrl_get_group()
commit 5a062c3 upstream. This should be >= pmx->soc->ngroups instead of > to avoid an out of bounds access. The pmx->soc->groups[] array is allocated in tegra_pinctrl_probe(). Fixes: c12bfa0 ("pinctrl-tegra: Restore SFSEL bit when freeing pins") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Kunwu Chan <kunwu.chan@linux.dev> Link: https://lore.kernel.org/82b40d9d-b437-42a9-9eb3-2328aa6877ac@stanley.mountain Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ecb9d31 commit 73c4707

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pinctrl/tegra/pinctrl-tegra.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ static const struct tegra_pingroup *tegra_pinctrl_get_group(struct pinctrl_dev *
305305
{
306306
struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
307307

308-
if (group_index < 0 || group_index > pmx->soc->ngroups)
308+
if (group_index < 0 || group_index >= pmx->soc->ngroups)
309309
return NULL;
310310

311311
return &pmx->soc->groups[group_index];

0 commit comments

Comments
 (0)