public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Vasily Averin <vvs@virtuozzo.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
	davem@davemloft.net, netdev@vger.kernel.org, nhorman@redhat.com,
	sassmann@redhat.com, jogreene@redhat.com
Subject: Re: [net,2/2] net: i40e: shut up uninitialized variable warnings
Date: Sun, 31 Jan 2016 15:59:17 +0100	[thread overview]
Message-ID: <2154537.J75p8oY6mX@wuerfel> (raw)
In-Reply-To: <56ACD7C6.1010808@virtuozzo.com>

On Saturday 30 January 2016 18:33:26 Vasily Averin wrote:
> On 26.01.2016 02:58, Jeff Kirsher wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > intel/i40e/i40e_txrx.c: In function 'i40e_xmit_frame_ring':
> > intel/i40e/i40e_txrx.c:2367:20: error: 'oiph' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > intel/i40e/i40e_txrx.c:2317:16: note: 'oiph' was declared here
> > intel/i40e/i40e_txrx.c:2367:17: error: 'oudph' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > intel/i40e/i40e_txrx.c:2316:17: note: 'oudph' was declared here
> 
> 2364                 if ((tx_ring->flags & I40E_TXR_FLAGS_OUTER_UDP_CSUM) &&
> 2365                     (l4_tunnel == I40E_TXD_CTX_UDP_TUNNELING)        &&
> 2366                     (*cd_tunneling & I40E_TXD_CTX_QW0_EXT_IP_MASK)) {
> 2367                         oudph->check = ~csum_tcpudp_magic(oiph->saddr,
> 2368                                         oiph->daddr,
> 2369                                         (skb->len - skb_transport_offset(skb)),
> 2370                                         IPPROTO_UDP, 0);
> 
> if compiler reports that oudph and oiph can be unitialized here,
> it's not enough just to set them to NULL.
> 
> Do we need probably to check that variables was initialized before access here?
> i.e. add  oudph && oiph into condition?

Sorry, I should not have mentioned my patch when it wasn't meant as
a serious submission. The patch I sent did not have a proper changelog
on it so it failed to explain it.

The reason why my patch works correctly is that the check on "l4_tunnel
== I40E_TXD_CTX_UDP_TUNNELING" means we can only get here if the
two variables have been initialized, and gcc fails to see this.

Jeff mentioned that he already had a patch for this, so I did not follow
up with a real patch.

	Arnd

  parent reply	other threads:[~2016-01-31 14:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 23:58 [net 0/2][pull request] Intel Wired LAN Driver Updates 2016-01-25 Jeff Kirsher
2016-01-25 23:58 ` [net 1/2] i40e: fix build warnings Jeff Kirsher
2016-01-25 23:58 ` [net 2/2] net: i40e: shut up uninitialized variable warnings Jeff Kirsher
2016-01-30 15:33   ` [net,2/2] " Vasily Averin
2016-01-30 16:47     ` [PATCH] net: i40e: prevent access to uninitilized variables in i40e_tx_enable_csum() Vasily Averin
2016-01-31 15:00       ` Arnd Bergmann
2016-01-31 14:59     ` Arnd Bergmann [this message]
2016-01-26  6:51 ` [net 0/2][pull request] Intel Wired LAN Driver Updates 2016-01-25 David Miller

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=2154537.J75p8oY6mX@wuerfel \
    --to=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jogreene@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.com \
    --cc=vvs@virtuozzo.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