From 2ce4fd5a0039b805a6716779e8669dd69a20ad60 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 15 Apr 2021 09:47:23 +0100 Subject: [PATCH 1/4] can: etas_es58x: Fix missing null check on netdev pointer There is an assignment to *netdev that is that can potentially be null but the null check is checking netdev and not *netdev as intended. Fix this by adding in the missing * operator. Fixes: 8537257874e9 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces") Link: https://lore.kernel.org/r/20210415084723.1807935-1-colin.king@canonical.com Addresses-Coverity: ("Dereference before null check") Signed-off-by: Colin Ian King Acked-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde --- drivers/net/can/usb/etas_es58x/es58x_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.h b/drivers/net/can/usb/etas_es58x/es58x_core.h index 5f4e7dc5be35..fcf219e727bf 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.h +++ b/drivers/net/can/usb/etas_es58x/es58x_core.h @@ -625,7 +625,7 @@ static inline int es58x_get_netdev(struct es58x_device *es58x_dev, return -ECHRNG; *netdev = es58x_dev->netdev[channel_idx]; - if (!netdev || !netif_device_present(*netdev)) + if (!*netdev || !netif_device_present(*netdev)) return -ENODEV; return 0; From 1c9690dd308efd05e7f390c15bc4f26842822bf5 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 15 Apr 2021 12:30:50 +0100 Subject: [PATCH 2/4] can: etas_es58x: Fix a couple of spelling mistakes There are spelling mistakes in netdev_dbg and netdev_dbg messages, fix these. Link: https://lore.kernel.org/r/20210415113050.1942333-1-colin.king@canonical.com Signed-off-by: Colin Ian King Signed-off-by: Marc Kleine-Budde --- drivers/net/can/usb/etas_es58x/es58x_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c index 57e5f94468e9..8e9102482c52 100644 --- a/drivers/net/can/usb/etas_es58x/es58x_core.c +++ b/drivers/net/can/usb/etas_es58x/es58x_core.c @@ -688,7 +688,7 @@ int es58x_rx_err_msg(struct net_device *netdev, enum es58x_err error, case ES58X_ERR_PROT_STUFF: if (net_ratelimit()) - netdev_dbg(netdev, "Error BITSUFF\n"); + netdev_dbg(netdev, "Error BITSTUFF\n"); if (cf) cf->data[2] |= CAN_ERR_PROT_STUFF; break; @@ -1015,7 +1015,7 @@ int es58x_rx_cmd_ret_u32(struct net_device *netdev, int ret; netdev_warn(netdev, - "%s: channel is already opened, closing and re-openning it to reflect new configuration\n", + "%s: channel is already opened, closing and re-opening it to reflect new configuration\n", ret_desc); ret = ops->disable_channel(es58x_priv(netdev)); if (ret) From 924e464f4a8a0bb9e011ed37342e7c23c1670dc2 Mon Sep 17 00:00:00 2001 From: Erik Flodin Date: Tue, 20 Apr 2021 21:12:00 +0200 Subject: [PATCH 3/4] can: add a note that RECV_OWN_MSGS frames are subject to filtering Some parts of the documentation may lead the reader to think that the socket's own frames are always received when CAN_RAW_RECV_OWN_MSGS is enabled, but all frames are subject to filtering. As explained by Marc Kleine-Budde: On TX complete of a CAN frame it's pushed into the RX path of the networking stack, along with the information of the originating socket. Then the CAN frame is delivered into AF_CAN, where it is passed on to all registered receivers depending on filters. One receiver is the sending socket in CAN_RAW. Then in CAN_RAW the it is checked if the sending socket has RECV_OWN_MSGS enabled. Link: https://lore.kernel.org/r/20210420191212.42753-1-erik@flodin.me Signed-off-by: Erik Flodin Signed-off-by: Marc Kleine-Budde --- Documentation/networking/can.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/networking/can.rst b/Documentation/networking/can.rst index f8dae662e454..f34cb0e4460e 100644 --- a/Documentation/networking/can.rst +++ b/Documentation/networking/can.rst @@ -608,6 +608,8 @@ demand: setsockopt(s, SOL_CAN_RAW, CAN_RAW_RECV_OWN_MSGS, &recv_own_msgs, sizeof(recv_own_msgs)); +Note that reception of a socket's own CAN frames are subject to the same +filtering as other CAN frames (see :ref:`socketcan-rawfilter`). .. _socketcan-rawfd: From e6b031d3c37f79d135c642834bdda7233a29db8d Mon Sep 17 00:00:00 2001 From: Erik Flodin Date: Sun, 25 Apr 2021 16:14:35 +0200 Subject: [PATCH 4/4] can: proc: fix rcvlist_* header alignment on 64-bit system Before this fix, the function and userdata columns weren't aligned: device can_id can_mask function userdata matches ident vcan0 92345678 9fffffff 0000000000000000 0000000000000000 0 raw vcan0 123 00000123 0000000000000000 0000000000000000 0 raw After the fix they are: device can_id can_mask function userdata matches ident vcan0 92345678 9fffffff 0000000000000000 0000000000000000 0 raw vcan0 123 00000123 0000000000000000 0000000000000000 0 raw Link: Link: https://lore.kernel.org/r/20210425141440.229653-1-erik@flodin.me Signed-off-by: Erik Flodin Signed-off-by: Marc Kleine-Budde --- net/can/proc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/can/proc.c b/net/can/proc.c index b15760b5c1cc..d1fe49e6f16d 100644 --- a/net/can/proc.c +++ b/net/can/proc.c @@ -205,8 +205,10 @@ static void can_print_recv_banner(struct seq_file *m) * can1. 00000000 00000000 00000000 * ....... 0 tp20 */ - seq_puts(m, " device can_id can_mask function" - " userdata matches ident\n"); + if (IS_ENABLED(CONFIG_64BIT)) + seq_puts(m, " device can_id can_mask function userdata matches ident\n"); + else + seq_puts(m, " device can_id can_mask function userdata matches ident\n"); } static int can_stats_proc_show(struct seq_file *m, void *v)