qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCHv7 7/9] slirp: Handle IPv6 in TCP functions


From: Samuel Thibault
Subject: Re: [Qemu-devel] [PATCHv7 7/9] slirp: Handle IPv6 in TCP functions
Date: Wed, 10 Feb 2016 13:30:14 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Thomas Huth, on Wed 10 Feb 2016 11:47:05 +0100, wrote:
> > +   ip = mtod(m, struct ip *);
> > +   ip6 = mtod(m, struct ip6 *);
> > +   save_ip = *ip;
> > +   save_ip6 = *ip6;
> 
> Could you do the "save_ip = *ip" within the "case AF_INET" below, and
> the "save_ip6 = *ip6" within the case AF_INET6 ? That would avoid to
> copy bytes that are not required.

The issue is that when save_ip is used later on in another switch/case,
the compiler will warn that save_ip may be used uninitialized, because
the compiler is not smart enough to realize that the two codes are under
the same conditions. It seems to happen that my current version of gcc
doesn't warn about save_ip, but it does warn about ip if I moved that
too for instance. So we can move the assignment indeed, but there will
probably be some compilers which will emit a warning here, I don't know
what we prefer.

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]