Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1508409
| From | David Laight <David.Laight@ACULAB.COM> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | RE: [PATCH] netfilter: ip_vs_sync: fix bogus maybe-uninitialized warning |
| Date | 2016-10-25 18:20 +0200 |
| Message-ID | <swcCe-7Zv-17@gated-at.bofh.it> (permalink) |
| References | <svPvY-14z-7@gated-at.bofh.it> <svTzz-3Fg-25@gated-at.bofh.it> <svU2C-47j-27@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Arnd Bergmann
> Sent: 24 October 2016 21:22
> On Monday, October 24, 2016 10:47:54 PM CEST Julian Anastasov wrote:
> > > diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
> > > index 1b07578bedf3..9350530c16c1 100644
> > > --- a/net/netfilter/ipvs/ip_vs_sync.c
> > > +++ b/net/netfilter/ipvs/ip_vs_sync.c
> > > @@ -283,6 +283,7 @@ struct ip_vs_sync_buff {
> > > */
> > > static void ntoh_seq(struct ip_vs_seq *no, struct ip_vs_seq *ho)
> > > {
> > > + memset(ho, 0, sizeof(*ho));
> > > ho->init_seq = get_unaligned_be32(&no->init_seq);
> > > ho->delta = get_unaligned_be32(&no->delta);
> > > ho->previous_delta = get_unaligned_be32(&no->previous_delta);
> >
> > So, now there is a double write here?
>
> Correct. I would hope that a sane version of gcc would just not
> perform the first write. What happens instead is that the version
> that produces the warning here moves the initialization to the
> top of the calling function.
Maybe doing the 3 get_unaligned_be32() before the memset will stop
the double-writes.
The problem is that the compiler doesn't know that the two structures
don't alias each other.
David
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] netfilter: ip_vs_sync: fix bogus maybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-10-24 17:40 +0200
Re: [PATCH] netfilter: ip_vs_sync: fix bogus maybe-uninitialized warning Julian Anastasov <ja@ssi.bg> - 2016-10-24 22:00 +0200
Re: [PATCH] netfilter: ip_vs_sync: fix bogus maybe-uninitialized warning Arnd Bergmann <arnd@arndb.de> - 2016-10-24 22:30 +0200
RE: [PATCH] netfilter: ip_vs_sync: fix bogus maybe-uninitialized warning David Laight <David.Laight@ACULAB.COM> - 2016-10-25 18:20 +0200
csiph-web