Skip to content

Commit ce2076b

Browse files
Dan Carpenterlinusw
authored andcommitted
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: a1d1e0e ("pinctrl: nuvoton: Add driver for WPCM450") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Jonathan Neuschäfer <[email protected]> Link: https://lore.kernel.org/r/20220318071131.GA29472@kili Signed-off-by: Linus Walleij <[email protected]>
1 parent 0bb8508 commit ce2076b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pinctrl/nuvoton/pinctrl-wpcm450.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
10431043
gpio = &pctrl->gpio_bank[reg];
10441044
gpio->pctrl = pctrl;
10451045

1046-
if (reg > WPCM450_NUM_BANKS)
1046+
if (reg >= WPCM450_NUM_BANKS)
10471047
return dev_err_probe(dev, -EINVAL,
10481048
"GPIO index %d out of range!\n", reg);
10491049

0 commit comments

Comments
 (0)