Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1397340

Re: [PATCH] netfilter: conntrack: remove uninitialized shadow variable

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH] netfilter: conntrack: remove uninitialized shadow variable
Date 2016-05-09 22:20 +0200
Message-ID <rwZOP-48t-17@gated-at.bofh.it> (permalink)
References <rwZlL-3xy-11@gated-at.bofh.it> <rwZF9-42D-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] netfilter: conntrack: remove uninitialized shadow variable Arnd Bergmann <arnd@arndb.de> - 2016-05-09 21:50 +0200
  Re: [PATCH] netfilter: conntrack: remove uninitialized shadow  variable Pablo Neira Ayuso <pablo@netfilter.org> - 2016-05-09 22:10 +0200
    Re: [PATCH] netfilter: conntrack: remove uninitialized shadow variable Arnd Bergmann <arnd@arndb.de> - 2016-05-09 22:20 +0200
  Re: [PATCH] netfilter: conntrack: remove uninitialized shadow  variable David Miller <davem@davemloft.net> - 2016-05-10 07:10 +0200

csiph-web