linux/drivers/net/can
Marc Kleine-Budde f006229135 can: kvaser_usb: hydra: help gcc-13 to figure out cmd_len
Debian's gcc-13 [1] throws the following error in
kvaser_usb_hydra_cmd_size():

[1] gcc version 13.0.0 20221214 (experimental) [master r13-4693-g512098a3316] (Debian 13-20221214-1)

| drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c:502:65: error:
| array subscript ‘struct kvaser_cmd_ext[0]’ is partly outside array
| bounds of ‘unsigned char[32]’ [-Werror=array-bounds=]
|   502 |                 ret = le16_to_cpu(((struct kvaser_cmd_ext *)cmd)->len);

kvaser_usb_hydra_cmd_size() returns the size of given command. It
depends on the command number (cmd->header.cmd_no). For extended
commands (cmd->header.cmd_no == CMD_EXTENDED) the above shown code is
executed.

Help gcc to recognize that this code path is not taken in all cases,
by calling kvaser_usb_hydra_cmd_size() directly after assigning the
command number.

Fixes: aec5fb2268 ("can: kvaser_usb: Add support for Kvaser USB hydra family")
Cc: Jimmy Assarsson <extja@kvaser.com>
Cc: Anssi Hannula <anssi.hannula@bitwise.fi>
Link: https://lore.kernel.org/all/20221219110104.1073881-1-mkl@pengutronix.de
Tested-by: Jimmy Assarsson <extja@kvaser.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2022-12-19 16:08:27 +01:00
..
c_can can: c_can: use devm_platform_get_and_ioremap_resource() 2022-12-12 11:39:12 +01:00
cc770 can: cc770: cc770_isa_probe(): add missing free_cc770dev() 2022-11-24 16:09:53 +01:00
ctucanfd can: ctucanfd: Drop obsolete dependency on COMPILE_TEST 2022-12-12 11:39:11 +01:00
dev can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
flexcan can: flexcan: avoid unbalanced pm_runtime_enable warning 2022-12-19 16:08:27 +01:00
ifi_canfd can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
m_can can: tcan4x5x: Specify separate read/write ranges 2022-12-12 12:01:01 +01:00
mscan can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
peak_canfd can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
rcar can: rcar_canfd: Add multi_channel_irqs to struct rcar_canfd_hw_info 2022-12-10 13:24:40 +01:00
sja1000 can: sja1000_isa: sja1000_isa_probe(): add missing free_sja1000dev() 2022-11-24 16:09:39 +01:00
slcan can: slcan: fix freed work crash 2022-12-07 10:32:24 +01:00
softing can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
spi can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
usb can: kvaser_usb: hydra: help gcc-13 to figure out cmd_len 2022-12-19 16:08:27 +01:00
at91_can.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
can327.c can: can327: flush TX_work on ldisc .close() 2022-12-07 10:32:36 +01:00
grcan.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
janz-ican3.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
Kconfig can: remove obsolete PCH CAN driver 2022-10-19 21:33:30 +02:00
kvaser_pciefd.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
Makefile can: remove obsolete PCH CAN driver 2022-10-19 21:33:30 +02:00
sun4i_can.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
ti_hecc.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00
vcan.c can: dev: add CAN XL support to virtual CAN 2022-09-15 09:08:09 +02:00
vxcan.c rtnetlink: pass netlink message header and portid to rtnl_configure_link() 2022-10-31 18:10:21 -07:00
xilinx_can.c can: dev: fix skb drop check 2022-11-07 14:00:27 +01:00