From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Vincent MAILHOL <mailhol.vincent@wanadoo.fr>
Cc: kernel test robot <yujie.liu@intel.com>,
kbuild-all@lists.01.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Arunachalam Santhanam <Arunachalam.Santhanam@in.bosch.com>,
linux-can <linux-can@vger.kernel.org>
Subject: Re: drivers/net/can/usb/etas_es58x/es58x_fd.c:174:8: warning: Uninitialized variable: rx_event_msg [uninitvar]
Date: Wed, 2 Mar 2022 14:04:23 +0100 [thread overview]
Message-ID: <20220302130423.ddd2ulldffpo5lb2@pengutronix.de> (raw)
In-Reply-To: <CAMZ6Rq+HR=j2mD97etTgSapOix96P=pK70bTr9HeJu2Mjkn3+g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1365 bytes --]
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 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-03-02 13:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <202203021333.mMJpWPzx-lkp@intel.com>
2022-03-02 9:47 ` drivers/net/can/usb/etas_es58x/es58x_fd.c:174:8: warning: Uninitialized variable: rx_event_msg [uninitvar] kernel test robot
2022-03-02 10:32 ` Marc Kleine-Budde
2022-03-02 12:49 ` Vincent MAILHOL
2022-03-02 13:04 ` Marc Kleine-Budde [this message]
2022-03-02 14:42 ` Vincent MAILHOL
2022-03-02 14:47 ` Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220302130423.ddd2ulldffpo5lb2@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=Arunachalam.Santhanam@in.bosch.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=yujie.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox