From: David Miller <davem@davemloft.net>
To: ogerlitz@mellanox.com
Cc: hadarh@mellanox.com, netdev@vger.kernel.org, arnd@arndb.de
Subject: Re: [PATCH net V2] net/mlx5e: Fix a -Wmaybe-uninitialized warning
Date: Mon, 16 Jan 2017 14:48:45 -0500 (EST) [thread overview]
Message-ID: <20170116.144845.60137914620939911.davem@davemloft.net> (raw)
In-Reply-To: <1484502646-29692-1-git-send-email-ogerlitz@mellanox.com>
From: Or Gerlitz <ogerlitz@mellanox.com>
Date: Sun, 15 Jan 2017 19:50:46 +0200
> From: Arnd Bergmann <arnd@arndb.de>
>
> As found by Olof's build bot, we gain a harmless warning about a
> potential uninitialized variable reference in mlx5:
>
> drivers/net/ethernet/mellanox/mlx5/core/en_tc.c: In function 'parse_tc_fdb_actions':
> drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:769:13: warning: 'out_dev' may be used uninitialized in this function [-Wmaybe-uninitialized]
> drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:811:21: note: 'out_dev' was declared here
>
> This was introduced through the addition of an 'IS_ERR/PTR_ERR' pair
> that gcc is unfortunately unable to completely figure out.
>
> The problem being gcc cannot tell that if(IS_ERR()) in
> mlx5e_route_lookup_ipv4() is equivalent to checking if(err) later,
> so it assumes that 'out_dev' is used after the 'return PTR_ERR(rt)'.
>
> The PTR_ERR_OR_ZERO() case by comparison is fairly easy to detect
> by gcc, so it can't get that wrong, so it no longer warns.
>
> Hadar Hen Zion already attempted to fix the warning earlier by adding fake
> initializations, but that ended up not fully addressing all warnings, so
> I'm reverting it now that it is no longer needed.
>
> Link: http://arm-soc.lixom.net/buildlogs/mainline/v4.10-rc3-98-gcff3b2c/
> Fixes: a42485eb0ee4 ("net/mlx5e: TC ipv4 tunnel encap offload error flow fixes")
> Fixes: a757d108dc1a ("net/mlx5e: Fix kbuild warnings for uninitialized parameters")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
> ---
> changes from V1:
> - kept calling ip_route_output_key() only when CONFIG_INET is defined
Applied.
prev parent reply other threads:[~2017-01-16 19:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-15 17:50 [PATCH net V2] net/mlx5e: Fix a -Wmaybe-uninitialized warning Or Gerlitz
2017-01-16 19:48 ` David Miller [this message]
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=20170116.144845.60137914620939911.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=arnd@arndb.de \
--cc=hadarh@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.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