From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
Cc: Linus Walleij <linus.walleij@linaro.org>,
openbmc@lists.ozlabs.org, linux-gpio@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] pinctrl: nuvoton: wpcm450: off by one in wpcm450_gpio_register()
Date: Fri, 18 Mar 2022 10:11:31 +0300 [thread overview]
Message-ID: <20220318071131.GA29472@kili> (raw)
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>
---
drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
index 661aa963e3fc..164d7a6e7b5b 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);
--
2.20.1
next reply other threads:[~2022-03-18 7:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-18 7:11 Dan Carpenter [this message]
2022-03-18 9:58 ` [PATCH] pinctrl: nuvoton: wpcm450: off by one in wpcm450_gpio_register() Jonathan Neuschäfer
2022-03-24 0:30 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220318071131.GA29472@kili \
--to=dan.carpenter@oracle.com \
--cc=j.neuschaefer@gmx.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=openbmc@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).