Skip to content

Commit 5a062c3

Browse files
Dan Carpenterlinusw
authored andcommitted
pinctrl: tegra: Fix off by one in tegra_pinctrl_get_group()
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 <[email protected]> Reviewed-by: Kunwu Chan <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 813b1a1 commit 5a062c3

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
@@ -306,7 +306,7 @@ static const struct tegra_pingroup *tegra_pinctrl_get_group(struct pinctrl_dev *
306306
{
307307
struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
308308

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

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

0 commit comments

Comments
 (0)