[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220302144748.tidd2zq2xfdqvoyl@pengutronix.de>
Date: Wed, 2 Mar 2022 15:47:48 +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 23:42:53, Vincent MAILHOL wrote:
> On Wed. 2 Mar 2022 at 22:04, Marc Kleine-Budde <mkl@...gutronix.de> wrote:
> > 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.
>
> Sorry, I do not get your example. If bar is NULL,
> | void *foo = bar->baz;
> would segfault and thus the check is not reached.
ACK
> If bar is not NULL, the check succeeds.
>
> In both cases, the return statement of the if branch is never
> executed making this some dead code. So I do not see why this is
> an issue if the compiler removes it.
IIRC in some cases the code was shuffled around by the compiler and the
NULL pointer check was done....and with a new compiler version it
stopped working :)
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