diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-03-18 10:11:31 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2022-03-24 22:10:32 +0300 |
commit | ce2076ba209e5e5258b71c44065988d8f7fa2976 (patch) | |
tree | b6dc152532d16ef0e55e195b7968369b98b9dd6e /drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | |
parent | 0bb850887c1e27ca81d1b4cd19db83f40a61dd30 (diff) | |
download | linux-ce2076ba209e5e5258b71c44065988d8f7fa2976.tar.xz |
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: a1d1e0e3d80a ("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>
Diffstat (limited to 'drivers/pinctrl/nuvoton/pinctrl-wpcm450.c')
-rw-r--r-- | drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c index 1402840af11f..f7565ce66651 100644 --- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c +++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c @@ -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); |