All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] can: kvaser_usb: silence a GCC 12 -Warray-bounds warning
@ 2022-05-20 19:46 Jakub Kicinski
  2022-05-23 12:14 ` Marc Kleine-Budde
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2022-05-20 19:46 UTC (permalink / raw)
  To: mkl; +Cc: davem, netdev, edumazet, pabeni, Jakub Kicinski, wg, linux-can

This driver does a lot of casting of smaller buffers to
struct kvaser_cmd_ext, GCC 12 does not like that:

drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c:489:65: warning: array subscript ‘struct kvaser_cmd_ext[0]’ is partly outside array bounds of ‘unsigned char[32]’ [-Warray-bounds]
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c:489:23: note: in expansion of macro ‘le16_to_cpu’
  489 |                 ret = le16_to_cpu(((struct kvaser_cmd_ext *)cmd)->len);
      |                       ^~~~~~~~~~~

Temporarily silence this warning (move it to W=1 builds).

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
Hi Marc, are you planning another -next PR? Can we take this
directly?

CC: wg@grandegger.com
CC: mkl@pengutronix.de
CC: linux-can@vger.kernel.org
---
 drivers/net/can/usb/kvaser_usb/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/can/usb/kvaser_usb/Makefile b/drivers/net/can/usb/kvaser_usb/Makefile
index cf260044f0b9..b20d951a0790 100644
--- a/drivers/net/can/usb/kvaser_usb/Makefile
+++ b/drivers/net/can/usb/kvaser_usb/Makefile
@@ -1,3 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_CAN_KVASER_USB) += kvaser_usb.o
 kvaser_usb-y = kvaser_usb_core.o kvaser_usb_leaf.o kvaser_usb_hydra.o
+
+# FIXME: temporarily silence -Warray-bounds on non W=1+ builds
+ifndef KBUILD_EXTRA_WARN
+CFLAGS_kvaser_usb_hydra.o += -Wno-array-bounds
+endif
-- 
2.34.3


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

* Re: [PATCH net-next] can: kvaser_usb: silence a GCC 12 -Warray-bounds warning
  2022-05-20 19:46 [PATCH net-next] can: kvaser_usb: silence a GCC 12 -Warray-bounds warning Jakub Kicinski
@ 2022-05-23 12:14 ` Marc Kleine-Budde
  2022-05-23 20:12   ` Marc Kleine-Budde
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2022-05-23 12:14 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, wg, linux-can

[-- Attachment #1: Type: text/plain, Size: 1126 bytes --]

On 20.05.2022 12:46:59, Jakub Kicinski wrote:
> This driver does a lot of casting of smaller buffers to
> struct kvaser_cmd_ext, GCC 12 does not like that:
> 
> drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c:489:65: warning: array subscript ‘struct kvaser_cmd_ext[0]’ is partly outside array bounds of ‘unsigned char[32]’ [-Warray-bounds]
> drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c:489:23: note: in expansion of macro ‘le16_to_cpu’
>   489 |                 ret = le16_to_cpu(((struct kvaser_cmd_ext *)cmd)->len);
>       |                       ^~~~~~~~~~~
> 
> Temporarily silence this warning (move it to W=1 builds).
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> Hi Marc, are you planning another -next PR? Can we take this
> directly?

Thanks, applied and I'll send a -next PR soonish.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH net-next] can: kvaser_usb: silence a GCC 12 -Warray-bounds warning
  2022-05-23 12:14 ` Marc Kleine-Budde
@ 2022-05-23 20:12   ` Marc Kleine-Budde
  0 siblings, 0 replies; 3+ messages in thread
From: Marc Kleine-Budde @ 2022-05-23 20:12 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni, wg, linux-can

[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]

On 23.05.2022 14:14:25, Marc Kleine-Budde wrote:
> On 20.05.2022 12:46:59, Jakub Kicinski wrote:
> > This driver does a lot of casting of smaller buffers to
> > struct kvaser_cmd_ext, GCC 12 does not like that:
> > 
> > drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c:489:65: warning: array subscript ‘struct kvaser_cmd_ext[0]’ is partly outside array bounds of ‘unsigned char[32]’ [-Warray-bounds]
> > drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c:489:23: note: in expansion of macro ‘le16_to_cpu’
> >   489 |                 ret = le16_to_cpu(((struct kvaser_cmd_ext *)cmd)->len);
> >       |                       ^~~~~~~~~~~
> > 
> > Temporarily silence this warning (move it to W=1 builds).
> > 
> > Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> > ---
> > Hi Marc, are you planning another -next PR? Can we take this
> > directly?
> 
> Thanks, applied and I'll send a -next PR soonish.

Available here:

https://lore.kernel.org/all/20220523201045.1708855-1-mkl@pengutronix.de/

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2022-05-23 20:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20 19:46 [PATCH net-next] can: kvaser_usb: silence a GCC 12 -Warray-bounds warning Jakub Kicinski
2022-05-23 12:14 ` Marc Kleine-Budde
2022-05-23 20:12   ` Marc Kleine-Budde

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.