* [PATCH] pinctrl: microchip: fix array overflow
@ 2021-03-23 13:09 ` Arnd Bergmann
0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2021-03-23 13:09 UTC (permalink / raw)
To: Lars Povlsen, Steen Hegelund, UNGLinuxDriver, Linus Walleij
Cc: Arnd Bergmann, Zou Wei, linux-arm-kernel, linux-gpio, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Building with 'make W=1' shows an array overflow:
drivers/pinctrl/pinctrl-microchip-sgpio.c: In function 'microchip_sgpio_irq_settype':
drivers/pinctrl/pinctrl-microchip-sgpio.c:154:39: error: array subscript 10 is above array bounds of 'const u8[10]' {aka 'const unsigned char[10]'} [-Werror=array-bounds]
154 | u32 regoff = priv->properties->regoff[rno] + off;
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
drivers/pinctrl/pinctrl-microchip-sgpio.c:55:5: note: while referencing 'regoff'
55 | u8 regoff[MAXREG];
| ^~~~~~
It's not clear to me what was meant here, my best guess is that the
offset should have been applied to the third argument instead of the
second.
Fixes: be2dc859abd4 ("pinctrl: pinctrl-microchip-sgpio: Add irq support (for sparx5)")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/pinctrl/pinctrl-microchip-sgpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c
index f35edb0eac40..4740613cdd03 100644
--- a/drivers/pinctrl/pinctrl-microchip-sgpio.c
+++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c
@@ -572,7 +572,7 @@ static void microchip_sgpio_irq_settype(struct irq_data *data,
/* Type value spread over 2 registers sets: low, high bit */
sgpio_clrsetbits(bank->priv, REG_INT_TRIGGER, addr.bit,
BIT(addr.port), (!!(type & 0x1)) << addr.port);
- sgpio_clrsetbits(bank->priv, REG_INT_TRIGGER + SGPIO_MAX_BITS, addr.bit,
+ sgpio_clrsetbits(bank->priv, REG_INT_TRIGGER, addr.bit + SGPIO_MAX_BITS,
BIT(addr.port), (!!(type & 0x2)) << addr.port);
if (type == SGPIO_INT_TRG_LEVEL)
--
2.29.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] pinctrl: microchip: fix array overflow
@ 2021-03-23 13:09 ` Arnd Bergmann
0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2021-03-23 13:09 UTC (permalink / raw)
To: Lars Povlsen, Steen Hegelund, UNGLinuxDriver, Linus Walleij
Cc: Arnd Bergmann, Zou Wei, linux-arm-kernel, linux-gpio, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Building with 'make W=1' shows an array overflow:
drivers/pinctrl/pinctrl-microchip-sgpio.c: In function 'microchip_sgpio_irq_settype':
drivers/pinctrl/pinctrl-microchip-sgpio.c:154:39: error: array subscript 10 is above array bounds of 'const u8[10]' {aka 'const unsigned char[10]'} [-Werror=array-bounds]
154 | u32 regoff = priv->properties->regoff[rno] + off;
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
drivers/pinctrl/pinctrl-microchip-sgpio.c:55:5: note: while referencing 'regoff'
55 | u8 regoff[MAXREG];
| ^~~~~~
It's not clear to me what was meant here, my best guess is that the
offset should have been applied to the third argument instead of the
second.
Fixes: be2dc859abd4 ("pinctrl: pinctrl-microchip-sgpio: Add irq support (for sparx5)")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/pinctrl/pinctrl-microchip-sgpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c
index f35edb0eac40..4740613cdd03 100644
--- a/drivers/pinctrl/pinctrl-microchip-sgpio.c
+++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c
@@ -572,7 +572,7 @@ static void microchip_sgpio_irq_settype(struct irq_data *data,
/* Type value spread over 2 registers sets: low, high bit */
sgpio_clrsetbits(bank->priv, REG_INT_TRIGGER, addr.bit,
BIT(addr.port), (!!(type & 0x1)) << addr.port);
- sgpio_clrsetbits(bank->priv, REG_INT_TRIGGER + SGPIO_MAX_BITS, addr.bit,
+ sgpio_clrsetbits(bank->priv, REG_INT_TRIGGER, addr.bit + SGPIO_MAX_BITS,
BIT(addr.port), (!!(type & 0x2)) << addr.port);
if (type == SGPIO_INT_TRG_LEVEL)
--
2.29.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: microchip: fix array overflow
2021-03-23 13:09 ` Arnd Bergmann
@ 2021-03-25 9:26 ` Linus Walleij
-1 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2021-03-25 9:26 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Lars Povlsen, Steen Hegelund, Microchip Linux Driver Support,
Arnd Bergmann, Zou Wei, Linux ARM, open list:GPIO SUBSYSTEM,
linux-kernel
On Tue, Mar 23, 2021 at 2:10 PM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Building with 'make W=1' shows an array overflow:
>
> drivers/pinctrl/pinctrl-microchip-sgpio.c: In function 'microchip_sgpio_irq_settype':
> drivers/pinctrl/pinctrl-microchip-sgpio.c:154:39: error: array subscript 10 is above array bounds of 'const u8[10]' {aka 'const unsigned char[10]'} [-Werror=array-bounds]
> 154 | u32 regoff = priv->properties->regoff[rno] + off;
> | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
> drivers/pinctrl/pinctrl-microchip-sgpio.c:55:5: note: while referencing 'regoff'
> 55 | u8 regoff[MAXREG];
> | ^~~~~~
>
> It's not clear to me what was meant here, my best guess is that the
> offset should have been applied to the third argument instead of the
> second.
>
> Fixes: be2dc859abd4 ("pinctrl: pinctrl-microchip-sgpio: Add irq support (for sparx5)")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: microchip: fix array overflow
@ 2021-03-25 9:26 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2021-03-25 9:26 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Lars Povlsen, Steen Hegelund, Microchip Linux Driver Support,
Arnd Bergmann, Zou Wei, Linux ARM, open list:GPIO SUBSYSTEM,
linux-kernel
On Tue, Mar 23, 2021 at 2:10 PM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Building with 'make W=1' shows an array overflow:
>
> drivers/pinctrl/pinctrl-microchip-sgpio.c: In function 'microchip_sgpio_irq_settype':
> drivers/pinctrl/pinctrl-microchip-sgpio.c:154:39: error: array subscript 10 is above array bounds of 'const u8[10]' {aka 'const unsigned char[10]'} [-Werror=array-bounds]
> 154 | u32 regoff = priv->properties->regoff[rno] + off;
> | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
> drivers/pinctrl/pinctrl-microchip-sgpio.c:55:5: note: while referencing 'regoff'
> 55 | u8 regoff[MAXREG];
> | ^~~~~~
>
> It's not clear to me what was meant here, my best guess is that the
> offset should have been applied to the third argument instead of the
> second.
>
> Fixes: be2dc859abd4 ("pinctrl: pinctrl-microchip-sgpio: Add irq support (for sparx5)")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Patch applied.
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: microchip: fix array overflow
2021-03-25 9:26 ` Linus Walleij
@ 2021-03-28 17:18 ` Lars Povlsen
-1 siblings, 0 replies; 8+ messages in thread
From: Lars Povlsen @ 2021-03-28 17:18 UTC (permalink / raw)
To: Linus Walleij
Cc: Arnd Bergmann, Lars Povlsen, Steen Hegelund,
Microchip Linux Driver Support, Arnd Bergmann, Zou Wei,
Linux ARM, open list:GPIO SUBSYSTEM, linux-kernel,
Gustavo A . R . Silva
Linus Walleij writes:
> On Tue, Mar 23, 2021 at 2:10 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> Building with 'make W=1' shows an array overflow:
>>
>> drivers/pinctrl/pinctrl-microchip-sgpio.c: In function 'microchip_sgpio_irq_settype':
>> drivers/pinctrl/pinctrl-microchip-sgpio.c:154:39: error: array subscript 10 is above array bounds of 'const u8[10]' {aka 'const unsigned char[10]'} [-Werror=array-bounds]
>> 154 | u32 regoff = priv->properties->regoff[rno] + off;
>> | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
>> drivers/pinctrl/pinctrl-microchip-sgpio.c:55:5: note: while referencing 'regoff'
>> 55 | u8 regoff[MAXREG];
>> | ^~~~~~
>>
>> It's not clear to me what was meant here, my best guess is that the
>> offset should have been applied to the third argument instead of the
>> second.
>>
>> Fixes: be2dc859abd4 ("pinctrl: pinctrl-microchip-sgpio: Add irq support (for sparx5)")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Patch applied.
>
> Yours,
> Linus Walleij
I don't understand - I submitted a fix for this already in February
(reported by Gustavo). It took some time for you to get it ack'ed - but
you did (Feb 1st).
Did it end up getting dropped?
---Lars
--
Lars Povlsen,
Microchip
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: microchip: fix array overflow
@ 2021-03-28 17:18 ` Lars Povlsen
0 siblings, 0 replies; 8+ messages in thread
From: Lars Povlsen @ 2021-03-28 17:18 UTC (permalink / raw)
To: Linus Walleij
Cc: Arnd Bergmann, Lars Povlsen, Steen Hegelund,
Microchip Linux Driver Support, Arnd Bergmann, Zou Wei,
Linux ARM, open list:GPIO SUBSYSTEM, linux-kernel,
Gustavo A . R . Silva
Linus Walleij writes:
> On Tue, Mar 23, 2021 at 2:10 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> Building with 'make W=1' shows an array overflow:
>>
>> drivers/pinctrl/pinctrl-microchip-sgpio.c: In function 'microchip_sgpio_irq_settype':
>> drivers/pinctrl/pinctrl-microchip-sgpio.c:154:39: error: array subscript 10 is above array bounds of 'const u8[10]' {aka 'const unsigned char[10]'} [-Werror=array-bounds]
>> 154 | u32 regoff = priv->properties->regoff[rno] + off;
>> | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
>> drivers/pinctrl/pinctrl-microchip-sgpio.c:55:5: note: while referencing 'regoff'
>> 55 | u8 regoff[MAXREG];
>> | ^~~~~~
>>
>> It's not clear to me what was meant here, my best guess is that the
>> offset should have been applied to the third argument instead of the
>> second.
>>
>> Fixes: be2dc859abd4 ("pinctrl: pinctrl-microchip-sgpio: Add irq support (for sparx5)")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Patch applied.
>
> Yours,
> Linus Walleij
I don't understand - I submitted a fix for this already in February
(reported by Gustavo). It took some time for you to get it ack'ed - but
you did (Feb 1st).
Did it end up getting dropped?
---Lars
--
Lars Povlsen,
Microchip
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: microchip: fix array overflow
2021-03-28 17:18 ` Lars Povlsen
@ 2021-03-30 9:04 ` Linus Walleij
-1 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2021-03-30 9:04 UTC (permalink / raw)
To: Lars Povlsen
Cc: Arnd Bergmann, Steen Hegelund, Microchip Linux Driver Support,
Arnd Bergmann, Zou Wei, Linux ARM, open list:GPIO SUBSYSTEM,
linux-kernel, Gustavo A . R . Silva
On Sun, Mar 28, 2021 at 7:18 PM Lars Povlsen <lars.povlsen@microchip.com> wrote:
> Linus Walleij writes:
>
> > On Tue, Mar 23, 2021 at 2:10 PM Arnd Bergmann <arnd@kernel.org> wrote:
> >
> >> From: Arnd Bergmann <arnd@arndb.de>
> >>
> >> Building with 'make W=1' shows an array overflow:
> >>
> >> drivers/pinctrl/pinctrl-microchip-sgpio.c: In function 'microchip_sgpio_irq_settype':
> >> drivers/pinctrl/pinctrl-microchip-sgpio.c:154:39: error: array subscript 10 is above array bounds of 'const u8[10]' {aka 'const unsigned char[10]'} [-Werror=array-bounds]
> >> 154 | u32 regoff = priv->properties->regoff[rno] + off;
> >> | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
> >> drivers/pinctrl/pinctrl-microchip-sgpio.c:55:5: note: while referencing 'regoff'
> >> 55 | u8 regoff[MAXREG];
> >> | ^~~~~~
> >>
> >> It's not clear to me what was meant here, my best guess is that the
> >> offset should have been applied to the third argument instead of the
> >> second.
> >>
> >> Fixes: be2dc859abd4 ("pinctrl: pinctrl-microchip-sgpio: Add irq support (for sparx5)")
> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >
> > Patch applied.
> >
> > Yours,
> > Linus Walleij
>
> I don't understand - I submitted a fix for this already in February
> (reported by Gustavo). It took some time for you to get it ack'ed - but
> you did (Feb 1st).
>
> Did it end up getting dropped?
No I ended up with your fix in fixes, then forgot about it and applied
Arnds fix to devel (for-next) and ended up getting a conflict in my
face.
Last night I rebased devel, dropped Arnds patch and thus solved
the conflict.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: microchip: fix array overflow
@ 2021-03-30 9:04 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2021-03-30 9:04 UTC (permalink / raw)
To: Lars Povlsen
Cc: Arnd Bergmann, Steen Hegelund, Microchip Linux Driver Support,
Arnd Bergmann, Zou Wei, Linux ARM, open list:GPIO SUBSYSTEM,
linux-kernel, Gustavo A . R . Silva
On Sun, Mar 28, 2021 at 7:18 PM Lars Povlsen <lars.povlsen@microchip.com> wrote:
> Linus Walleij writes:
>
> > On Tue, Mar 23, 2021 at 2:10 PM Arnd Bergmann <arnd@kernel.org> wrote:
> >
> >> From: Arnd Bergmann <arnd@arndb.de>
> >>
> >> Building with 'make W=1' shows an array overflow:
> >>
> >> drivers/pinctrl/pinctrl-microchip-sgpio.c: In function 'microchip_sgpio_irq_settype':
> >> drivers/pinctrl/pinctrl-microchip-sgpio.c:154:39: error: array subscript 10 is above array bounds of 'const u8[10]' {aka 'const unsigned char[10]'} [-Werror=array-bounds]
> >> 154 | u32 regoff = priv->properties->regoff[rno] + off;
> >> | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
> >> drivers/pinctrl/pinctrl-microchip-sgpio.c:55:5: note: while referencing 'regoff'
> >> 55 | u8 regoff[MAXREG];
> >> | ^~~~~~
> >>
> >> It's not clear to me what was meant here, my best guess is that the
> >> offset should have been applied to the third argument instead of the
> >> second.
> >>
> >> Fixes: be2dc859abd4 ("pinctrl: pinctrl-microchip-sgpio: Add irq support (for sparx5)")
> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >
> > Patch applied.
> >
> > Yours,
> > Linus Walleij
>
> I don't understand - I submitted a fix for this already in February
> (reported by Gustavo). It took some time for you to get it ack'ed - but
> you did (Feb 1st).
>
> Did it end up getting dropped?
No I ended up with your fix in fixes, then forgot about it and applied
Arnds fix to devel (for-next) and ended up getting a conflict in my
face.
Last night I rebased devel, dropped Arnds patch and thus solved
the conflict.
Yours,
Linus Walleij
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-03-30 9:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 13:09 [PATCH] pinctrl: microchip: fix array overflow Arnd Bergmann
2021-03-23 13:09 ` Arnd Bergmann
2021-03-25 9:26 ` Linus Walleij
2021-03-25 9:26 ` Linus Walleij
2021-03-28 17:18 ` Lars Povlsen
2021-03-28 17:18 ` Lars Povlsen
2021-03-30 9:04 ` Linus Walleij
2021-03-30 9:04 ` 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.