All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: nuvoton: wpcm450: off by one in wpcm450_gpio_register()
@ 2022-03-18  7:11 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-03-18  7:11 UTC (permalink / raw)
  To: Jonathan Neuschäfer
  Cc: Linus Walleij, openbmc, linux-gpio, kernel-janitors

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] pinctrl: nuvoton: wpcm450: off by one in wpcm450_gpio_register()
@ 2022-03-18  7:11 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-03-18  7:11 UTC (permalink / raw)
  To: Jonathan Neuschäfer
  Cc: linux-gpio, Linus Walleij, kernel-janitors, openbmc

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] pinctrl: nuvoton: wpcm450: off by one in wpcm450_gpio_register()
  2022-03-18  7:11 ` Dan Carpenter
@ 2022-03-18  9:58   ` Jonathan Neuschäfer
  -1 siblings, 0 replies; 6+ messages in thread
From: Jonathan Neuschäfer @ 2022-03-18  9:58 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jonathan Neuschäfer, Linus Walleij, openbmc, linux-gpio,
	kernel-janitors

[-- 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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pinctrl: nuvoton: wpcm450: off by one in wpcm450_gpio_register()
@ 2022-03-18  9:58   ` Jonathan Neuschäfer
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Neuschäfer @ 2022-03-18  9:58 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: linux-gpio, Linus Walleij, kernel-janitors,
	Jonathan Neuschäfer, openbmc

[-- 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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pinctrl: nuvoton: wpcm450: off by one in wpcm450_gpio_register()
  2022-03-18  7:11 ` Dan Carpenter
@ 2022-03-24  0:30   ` Linus Walleij
  -1 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2022-03-24  0:30 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jonathan Neuschäfer, openbmc, linux-gpio, kernel-janitors

On Fri, Mar 18, 2022 at 8:11 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:

> 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>

Patch applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pinctrl: nuvoton: wpcm450: off by one in wpcm450_gpio_register()
@ 2022-03-24  0:30   ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2022-03-24  0:30 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: linux-gpio, openbmc, kernel-janitors, Jonathan Neuschäfer

On Fri, Mar 18, 2022 at 8:11 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:

> 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>

Patch applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-24  0:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-18  7:11 [PATCH] pinctrl: nuvoton: wpcm450: off by one in wpcm450_gpio_register() Dan Carpenter
2022-03-18  7:11 ` Dan Carpenter
2022-03-18  9:58 ` Jonathan Neuschäfer
2022-03-18  9:58   ` Jonathan Neuschäfer
2022-03-24  0:30 ` Linus Walleij
2022-03-24  0:30   ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.