[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220302130423.ddd2ulldffpo5lb2@pengutronix.de>
Date: Wed, 2 Mar 2022 14:04:23 +0100
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Vincent MAILHOL <mailhol.vincent@...adoo.fr>
Cc: kernel test robot <yujie.liu@...el.com>, kbuild-all@...ts.01.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Arunachalam Santhanam <Arunachalam.Santhanam@...bosch.com>,
linux-can <linux-can@...r.kernel.org>
Subject: Re: drivers/net/can/usb/etas_es58x/es58x_fd.c:174:8: warning:
Uninitialized variable: rx_event_msg [uninitvar]
On 02.03.2022 21:49:27, Vincent MAILHOL wrote:
> > I think it's possible to assign rx_event_msg before the
> > es58x_check_msg_len().
>
> Yes, I will do so. Even if this is a false positive, this pattern
> can be misleading. e.g. during a code review, this does indeed
> look incorrect at first glance.
>
> Also, doing such change would be consistent with was is done in
> other functions:
> https://elixir.bootlin.com/linux/latest/source/drivers/net/can/usb/etas_es58x/es58x_fd.c#L210
>
> This not being a bug fix, is it fine to send it to net-next?
ACK
> Or do you see a need to backport this?
Don't think so.
> > I think (hope?) the compiler will not optimize
> > anything away. :)
>
> With a function call and a return statement, the compiler would
> need to be severely defective to try to optimize this away :)
I was thinking of this:
| void *foo = bar->baz;
|
| if (!bar)
| return;
|
| printf("%p", foo);
There were/are compilers that optimize the bar NULL pointer check away,
because bar has already been de-referenced.
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