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


Groups > linux.kernel > #1510991 > unrolled thread

Re: [PATCH] netfilter: ip_vs_sync: fix bogus maybe-uninitialized warning

Started byPablo Neira Ayuso <pablo@netfilter.org>
First post2016-10-28 11:40 +0200
Last post2016-10-28 14:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] netfilter: ip_vs_sync: fix bogus maybe-uninitialized  warning Pablo Neira Ayuso <pablo@netfilter.org> - 2016-10-28 11:40 +0200
    Re: [PATCH] netfilter: ip_vs_sync: fix bogus maybe-uninitialized  warning Simon Horman <horms@verge.net.au> - 2016-10-28 13:50 +0200
      Re: [PATCH] netfilter: ip_vs_sync: fix bogus maybe-uninitialized  warning Pablo Neira Ayuso <pablo@netfilter.org> - 2016-10-28 14:20 +0200

#1510991 — Re: [PATCH] netfilter: ip_vs_sync: fix bogus maybe-uninitialized warning

FromPablo Neira Ayuso <pablo@netfilter.org>
Date2016-10-28 11:40 +0200
SubjectRe: [PATCH] netfilter: ip_vs_sync: fix bogus maybe-uninitialized warning
Message-ID<sxbNL-6sc-3@gated-at.bofh.it>
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!

[toc] | [next] | [standalone]


#1511077

FromSimon Horman <horms@verge.net.au>
Date2016-10-28 13:50 +0200
Message-ID<sxdPA-7Lg-9@gated-at.bofh.it>
In reply to#1510991
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>

[toc] | [prev] | [next] | [standalone]


#1511089

FromPablo Neira Ayuso <pablo@netfilter.org>
Date2016-10-28 14:20 +0200
Message-ID<sxeiB-8eo-1@gated-at.bofh.it>
In reply to#1511077
On Fri, Oct 28, 2016 at 01:40:23PM +0200, Simon Horman wrote:
> 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.

Thanks Simon, feel free to exercise this path anytime.

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

Applied to nf, thanks!

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web