mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-09 07:51:16 -04:00
pinctrl: nuvoton: wpcm450: off by one in wpcm450_gpio_register()
The > WPCM450_NUM_BANKS should be >= or it leads to an out of bounds
access on the next line.
Fixes: a1d1e0e3d8 ("pinctrl: nuvoton: Add driver for WPCM450")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Link: https://lore.kernel.org/r/20220318071131.GA29472@kili
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
committed by
Linus Walleij
parent
0bb850887c
commit
ce2076ba20
@@ -1043,7 +1043,7 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
|
||||
gpio = &pctrl->gpio_bank[reg];
|
||||
gpio->pctrl = pctrl;
|
||||
|
||||
if (reg > WPCM450_NUM_BANKS)
|
||||
if (reg >= WPCM450_NUM_BANKS)
|
||||
return dev_err_probe(dev, -EINVAL,
|
||||
"GPIO index %d out of range!\n", reg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user