linux-stable/drivers/net/can
Vincent Mailhol 8e0b025167 can: etas_es58x: es58x_fd_rx_event_msg(): initialize rx_event_msg before calling es58x_check_msg_len()
[ Upstream commit 7a8cd7c0ee ]

Function es58x_fd_rx_event() invokes the es58x_check_msg_len() macro:

| 	ret = es58x_check_msg_len(es58x_dev->dev, *rx_event_msg, msg_len);

While doing so, it dereferences an uninitialized
variable: *rx_event_msg.

This is actually harmless because es58x_check_msg_len() only uses
preprocessor macros (sizeof() and __stringify()) on
*rx_event_msg. c.f. [1].

Nonetheless, this pattern is confusing so the lines are reordered to
make sure that rx_event_msg is correctly initialized.

This patch also fixes a false positive warning reported by cppcheck:

| cppcheck possible warnings: (new ones prefixed by >>, may not be real problems)
|
|    In file included from drivers/net/can/usb/etas_es58x/es58x_fd.c:
| >> drivers/net/can/usb/etas_es58x/es58x_fd.c:174:8: warning: Uninitialized variable: rx_event_msg [uninitvar]
|     ret = es58x_check_msg_len(es58x_dev->dev, *rx_event_msg, msg_len);
|           ^

[1] https://elixir.bootlin.com/linux/v5.16/source/drivers/net/can/usb/etas_es58x/es58x_core.h#L467

Link: https://lore.kernel.org/all/20220306101302.708783-1-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-13 19:27:20 +02:00
..
c_can can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
cc770 can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
dev can: netlink: report the CAN controller mode supported flags 2022-01-05 12:09:06 +01:00
flexcan can: flexcan: mark RX via mailboxes as supported on MCF5441X 2022-01-24 18:27:43 +01:00
ifi_canfd can: do not increase rx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
m_can can: m_can: m_can_tx_handler(): fix use after free of skb 2022-04-08 13:57:19 +02:00
mscan can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
peak_canfd can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
rcar can: rcar_canfd: rcar_canfd_channel_probe(): register the CAN device when fully ready 2022-02-25 17:46:54 +01:00
sja1000 can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
softing Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-01-09 17:00:17 -08:00
spi can: mcp251xfd: mcp251xfd_register_get_dev_id(): fix return of error value 2022-04-08 13:58:54 +02:00
usb can: etas_es58x: es58x_fd_rx_event_msg(): initialize rx_event_msg before calling es58x_check_msg_len() 2022-04-13 19:27:20 +02:00
at91_can.c can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
grcan.c can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
janz-ican3.c can: janz-ican3: initialize dlc variable 2022-01-08 20:17:41 +01:00
Kconfig can: flexcan: update Kconfig to enable coldfire 2021-07-25 11:36:29 +02:00
kvaser_pciefd.c can: do not increase rx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
led.c
Makefile can: flexcan: move driver into separate sub directory 2022-01-08 20:17:42 +01:00
pch_can.c can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
slcan.c TTY/Serial driver updates for 5.17-rc1 2022-01-12 11:21:52 -08:00
sun4i_can.c can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
ti_hecc.c can: ti_hecc: ti_hecc_probe(): use platform_get_irq() to get the interrupt 2022-01-05 12:08:19 +01:00
vcan.c can: do not increase tx_bytes statistics for RTR frames 2022-01-05 12:09:05 +01:00
vxcan.c vxcan: enable local echo for sent CAN frames 2022-04-08 13:58:17 +02:00
xilinx_can.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-01-09 17:00:17 -08:00