netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Julian Anastasov <ja@ssi.bg>, Arnd Bergmann <arnd@arndb.de>,
	Wensong Zhang <wensong@linux-vs.org>,
	Patrick McHardy <kaber@trash.net>,
	Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>,
	"David S. Miller" <davem@davemloft.net>,
	Quentin Armitage <quentin@armitage.org.uk>,
	netdev@vger.kernel.org, lvs-devel@vger.kernel.org,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] netfilter: ip_vs_sync: fix bogus maybe-uninitialized warning
Date: Fri, 28 Oct 2016 13:40:23 +0200	[thread overview]
Message-ID: <20161028114020.GA4041@verge.net.au> (raw)
In-Reply-To: <20161028093422.GA29559@salvia>

On Fri, Oct 28, 2016 at 11:34:22AM +0200, Pablo Neira Ayuso wrote:
> On Mon, Oct 24, 2016 at 10:47:54PM +0300, Julian Anastasov wrote:
> > 
> > 	Hello,
> > 
> > On Mon, 24 Oct 2016, Arnd Bergmann wrote:
> > 
> > > Building the ip_vs_sync code with CONFIG_OPTIMIZE_INLINING on x86
> > > confuses the compiler to the point where it produces a rather
> > > dubious warning message:
> > > 
> > > net/netfilter/ipvs/ip_vs_sync.c:1073:33: error: ‘opt.init_seq’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > >   struct ip_vs_sync_conn_options opt;
> > >                                  ^~~
> > > net/netfilter/ipvs/ip_vs_sync.c:1073:33: error: ‘opt.delta’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > > net/netfilter/ipvs/ip_vs_sync.c:1073:33: error: ‘opt.previous_delta’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > > net/netfilter/ipvs/ip_vs_sync.c:1073:33: error: ‘*((void *)&opt+12).init_seq’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > > net/netfilter/ipvs/ip_vs_sync.c:1073:33: error: ‘*((void *)&opt+12).delta’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > > net/netfilter/ipvs/ip_vs_sync.c:1073:33: error: ‘*((void *)&opt+12).previous_delta’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > > 
> > > The problem appears to be a combination of a number of factors, including
> > > the __builtin_bswap32 compiler builtin being slightly odd, having a large
> > > amount of code inlined into a single function, and the way that some
> > > functions only get partially inlined here.
> > > 
> > > I've spent way too much time trying to work out a way to improve the
> > > code, but the best I've come up with is to add an explicit memset
> > > right before the ip_vs_seq structure is first initialized here. When
> > > the compiler works correctly, this has absolutely no effect, but in the
> > > case that produces the warning, the warning disappears.
> > > 
> > > In the process of analysing this warning, I also noticed that
> > > we use memcpy to copy the larger ip_vs_sync_conn_options structure
> > > over two members of the ip_vs_conn structure. This works because
> > > the layout is identical, but seems error-prone, so I'm changing
> > > this in the process to directly copy the two members. This change
> > > seemed to have no effect on the object code or the warning, but
> > > it deals with the same data, so I kept the two changes together.
> > > 
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > 
> > 	OK,
> > 
> > Acked-by: Julian Anastasov <ja@ssi.bg>
> > 
> > 	I guess, Simon will take the patch for ipvs-next.
> 
> @Simon: If you have no more pending updates, I can save you one pull
> request for this small fix by placing this.

Thanks Pablo, please do.

Signed-off-by: Simon Horman <horms@verge.net.au>

  reply	other threads:[~2016-10-28 11:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-24 15:34 [PATCH] netfilter: ip_vs_sync: fix bogus maybe-uninitialized warning Arnd Bergmann
2016-10-24 19:47 ` Julian Anastasov
2016-10-24 20:21   ` Arnd Bergmann
2016-10-25 16:15     ` David Laight
2016-10-28  9:34   ` Pablo Neira Ayuso
2016-10-28 11:40     ` Simon Horman [this message]
2016-10-28 12:16       ` Pablo Neira Ayuso

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=20161028114020.GA4041@verge.net.au \
    --to=horms@verge.net.au \
    --cc=arnd@arndb.de \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=ja@ssi.bg \
    --cc=kaber@trash.net \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvs-devel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=quentin@armitage.org.uk \
    --cc=wensong@linux-vs.org \
    /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).