[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220307084142.orb2s3ip7ozsfffl@pengutronix.de>
Date: Mon, 7 Mar 2022 09:41:42 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Cc: linux-can@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel test robot <yujie.liu@...el.com>
Subject: Re: [PATCH] can: etas_es58x: initialize rx_event_msg before calling
es58x_check_msg_len()
On 06.03.2022 19:13:02, Vincent Mailhol wrote:
> 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 deferences an uninitialized variable: *rx_event_msg.
>
> This is actually harmless because es58x_check_msg_len() only uses
> preprocessors macro (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/latest/source/drivers/net/can/usb/etas_es58x/es58x_core.h#L467
>
> Reported-by: kernel test robot <yujie.liu@...el.com>
> Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Applied to linux-can-next/testing, fixed some typos and removed the
Reported-by tag.
regards,
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 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists