Re: drivers/net/can/usb/etas_es58x/es58x_fd.c:174:8: warning: Uninitialized variable: rx_event_msg [uninitvar]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02.03.2022 23:42:53, Vincent MAILHOL wrote:
> On Wed. 2 Mar 2022 at 22:04, Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> 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 |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux