[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
- Re: [Qemu-devel] [PATCHv7 6/9] slirp: Reindent after refactoring, (continued)
[Qemu-devel] [PATCHv7 4/9] slirp: Factorizing tcpiphdr structure with an union, Samuel Thibault, 2016/02/08
[Qemu-devel] [PATCHv7 8/9] slirp: Adding IPv6 address for DNS relay, Samuel Thibault, 2016/02/08
[Qemu-devel] [PATCHv7 7/9] slirp: Handle IPv6 in TCP functions, Samuel Thibault, 2016/02/08
[Qemu-devel] [PATCHv7 5/9] slirp: Generalizing and neutralizing various TCP functions before adding IPv6 stuff, Samuel Thibault, 2016/02/08
[Qemu-devel] [PATCHv7 9/9] qapi-schema, qemu-options & slirp: Adding Qemu options for IPv6 addresses, Samuel Thibault, 2016/02/08