linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>,
	Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
	"David S. Miller" <davem@davemloft.net>,
	Florian Westphal <fw@strlen.de>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Sasha Levin <sasha.levin@oracle.com>,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] netfilter: conntrack: remove uninitialized shadow variable
Date: Mon, 09 May 2016 22:12:31 +0200	[thread overview]
Message-ID: <5600782.TOr8CDRnac@wuerfel> (raw)
In-Reply-To: <20160509200117.GA6957@salvia>

On Monday 09 May 2016 22:01:17 Pablo Neira Ayuso wrote:
> On Mon, May 09, 2016 at 09:47:23PM +0200, Arnd Bergmann wrote:
> > A recent commit introduced an unconditional use of an uninitialized
> > variable, as reported in this gcc warning:
> > 
> > net/netfilter/nf_conntrack_core.c: In function '__nf_conntrack_confirm':
> > net/netfilter/nf_conntrack_core.c:632:33: error: 'ctinfo' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> >    bytes = atomic64_read(&counter[CTINFO2DIR(ctinfo)].bytes);
> >                                  ^
> > net/netfilter/nf_conntrack_core.c:628:26: note: 'ctinfo' was declared here
> >    enum ip_conntrack_info ctinfo;
> > 
> > The problem is that a local variable shadows the function parameter.
> > This removes the local variable, which looks like what Pablo originally
> > intended.
> 
> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
> 
> Sorry for this, I wonder why gcc didn't catch up this here.
> 
> @David, you can integrate this into your net-next tree.
> 
> Thanks for fixing up this Arnd.

By default, an allmodconfig build will hide these warnings because of
excessive false positives from CONFIG_CC_OPTIMIZE_FOR_SIZE. I've
tried twice to get a patch merged that disables CONFIG_CC_OPTIMIZE_FOR_SIZE
in allmodconfig so we get better warnings, but that patch unfortunately
got ignored.

	Arnd

  reply	other threads:[~2016-05-09 20:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-09 19:47 [PATCH] netfilter: conntrack: remove uninitialized shadow variable Arnd Bergmann
2016-05-09 20:01 ` Pablo Neira Ayuso
2016-05-09 20:12   ` Arnd Bergmann [this message]
2016-05-10  5:04 ` 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=5600782.TOr8CDRnac@wuerfel \
    --to=arnd@arndb.de \
    --cc=coreteam@netfilter.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=kaber@trash.net \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=sasha.levin@oracle.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;
as well as URLs for NNTP newsgroup(s).