From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
"Linus Walleij" <linus.walleij@linaro.org>,
openbmc@lists.ozlabs.org, linux-gpio@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] pinctrl: nuvoton: wpcm450: off by one in wpcm450_gpio_register()
Date: Fri, 18 Mar 2022 10:58:15 +0100 [thread overview]
Message-ID: <YjRXtzaiphcz9V3W@latitude> (raw)
In-Reply-To: <20220318071131.GA29472@kili>
[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]
On Fri, Mar 18, 2022 at 10:11:31AM +0300, Dan Carpenter wrote:
> The > WPCM450_NUM_BANKS should be >= or it leads to an out of bounds
> access on the next line.
True.
> 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>
Thanks,
Jonathan
> 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
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-03-18 9:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-18 7:11 [PATCH] pinctrl: nuvoton: wpcm450: off by one in wpcm450_gpio_register() Dan Carpenter
2022-03-18 9:58 ` Jonathan Neuschäfer [this message]
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=YjRXtzaiphcz9V3W@latitude \
--to=j.neuschaefer@gmx.net \
--cc=dan.carpenter@oracle.com \
--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).