linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: rza1: off by one in rza1_parse_gpiochip()
@ 2017-08-18 10:32 Dan Carpenter
  2017-08-23  7:20 ` Linus Walleij
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dan Carpenter @ 2017-08-18 10:32 UTC (permalink / raw)
  To: Linus Walleij, Jacopo Mondi; +Cc: linux-gpio, linux-kernel, kernel-janitors

The rza1_pctl->ports[] array has RZA1_NPORTS (12) elements.  The > here
should be >= to prevent an out of bounds access.

Fixes: 5a49b644b307 ("pinctrl: Renesas RZ/A1 pin and gpio controller")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/pinctrl/pinctrl-rza1.c b/drivers/pinctrl/pinctrl-rza1.c
index 7e30134b3d18..464dbf2f0816 100644
--- a/drivers/pinctrl/pinctrl-rza1.c
+++ b/drivers/pinctrl/pinctrl-rza1.c
@@ -1088,7 +1088,7 @@ static int rza1_parse_gpiochip(struct rza1_pinctrl *rza1_pctl,
 	 */
 	pinctrl_base = of_args.args[1];
 	gpioport = RZA1_PIN_ID_TO_PORT(pinctrl_base);
-	if (gpioport > RZA1_NPORTS) {
+	if (gpioport >= RZA1_NPORTS) {
 		dev_err(rza1_pctl->dev,
 			"Invalid values in property %s\n", list_name);
 		return -EINVAL;

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

* Re: [PATCH] pinctrl: rza1: off by one in rza1_parse_gpiochip()
  2017-08-18 10:32 [PATCH] pinctrl: rza1: off by one in rza1_parse_gpiochip() Dan Carpenter
@ 2017-08-23  7:20 ` Linus Walleij
  2017-08-23  7:35 ` Geert Uytterhoeven
  2017-08-31 11:38 ` Linus Walleij
  2 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2017-08-23  7:20 UTC (permalink / raw)
  To: Dan Carpenter, Geert Uytterhoeven, jacopo
  Cc: Jacopo Mondi, linux-gpio, linux-kernel, kernel-janitors

On Fri, Aug 18, 2017 at 12:32 PM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:

> The rza1_pctl->ports[] array has RZA1_NPORTS (12) elements.  The > here
> should be >= to prevent an out of bounds access.
>
> Fixes: 5a49b644b307 ("pinctrl: Renesas RZ/A1 pin and gpio controller")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/pinctrl/pinctrl-rza1.c b/drivers/pinctrl/pinctrl-rza1.c
> index 7e30134b3d18..464dbf2f0816 100644
> --- a/drivers/pinctrl/pinctrl-rza1.c
> +++ b/drivers/pinctrl/pinctrl-rza1.c
> @@ -1088,7 +1088,7 @@ static int rza1_parse_gpiochip(struct rza1_pinctrl *rza1_pctl,
>          */
>         pinctrl_base = of_args.args[1];
>         gpioport = RZA1_PIN_ID_TO_PORT(pinctrl_base);
> -       if (gpioport > RZA1_NPORTS) {
> +       if (gpioport >= RZA1_NPORTS) {
>                 dev_err(rza1_pctl->dev,
>                         "Invalid values in property %s\n", list_name);
>                 return -EINVAL;

Geert/Jacopo, can any of you ACK this?

Yours,
Linus Walleij

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

* Re: [PATCH] pinctrl: rza1: off by one in rza1_parse_gpiochip()
  2017-08-18 10:32 [PATCH] pinctrl: rza1: off by one in rza1_parse_gpiochip() Dan Carpenter
  2017-08-23  7:20 ` Linus Walleij
@ 2017-08-23  7:35 ` Geert Uytterhoeven
  2017-08-23  7:42   ` jmondi
  2017-08-31 11:38 ` Linus Walleij
  2 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2017-08-23  7:35 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Linus Walleij, Jacopo Mondi, linux-gpio, linux-kernel, kernel-janitors

On Fri, Aug 18, 2017 at 12:32 PM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:
> The rza1_pctl->ports[] array has RZA1_NPORTS (12) elements.  The > here
> should be >= to prevent an out of bounds access.
>
> Fixes: 5a49b644b307 ("pinctrl: Renesas RZ/A1 pin and gpio controller")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] pinctrl: rza1: off by one in rza1_parse_gpiochip()
  2017-08-23  7:35 ` Geert Uytterhoeven
@ 2017-08-23  7:42   ` jmondi
  0 siblings, 0 replies; 5+ messages in thread
From: jmondi @ 2017-08-23  7:42 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Dan Carpenter, Linus Walleij, Jacopo Mondi, linux-gpio,
	linux-kernel, kernel-janitors

Hi Linus,
   sorry for being late.

With Geert's approval I guess my ack is not that necessary, but...

On Wed, Aug 23, 2017 at 09:35:42AM +0200, Geert Uytterhoeven wrote:
> On Fri, Aug 18, 2017 at 12:32 PM, Dan Carpenter
> <dan.carpenter@oracle.com> wrote:
> > The rza1_pctl->ports[] array has RZA1_NPORTS (12) elements.  The > here
> > should be >= to prevent an out of bounds access.
> >
> > Fixes: 5a49b644b307 ("pinctrl: Renesas RZ/A1 pin and gpio controller")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Acked-by: Jacopo Mondi <jacopo@jmondi.org>

>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

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

* Re: [PATCH] pinctrl: rza1: off by one in rza1_parse_gpiochip()
  2017-08-18 10:32 [PATCH] pinctrl: rza1: off by one in rza1_parse_gpiochip() Dan Carpenter
  2017-08-23  7:20 ` Linus Walleij
  2017-08-23  7:35 ` Geert Uytterhoeven
@ 2017-08-31 11:38 ` Linus Walleij
  2 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2017-08-31 11:38 UTC (permalink / raw)
  To: Dan Carpenter, Geert Uytterhoeven
  Cc: Jacopo Mondi, linux-gpio, linux-kernel, kernel-janitors

On Fri, Aug 18, 2017 at 12:32 PM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:

> The rza1_pctl->ports[] array has RZA1_NPORTS (12) elements.  The > here
> should be >= to prevent an out of bounds access.
>
> Fixes: 5a49b644b307 ("pinctrl: Renesas RZ/A1 pin and gpio controller")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied with the ACKs.

Yours,
Linus Walleij

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

end of thread, other threads:[~2017-08-31 11:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-18 10:32 [PATCH] pinctrl: rza1: off by one in rza1_parse_gpiochip() Dan Carpenter
2017-08-23  7:20 ` Linus Walleij
2017-08-23  7:35 ` Geert Uytterhoeven
2017-08-23  7:42   ` jmondi
2017-08-31 11:38 ` Linus Walleij

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