Revision 1229e46d3cfe61ee0b11f08fbbc7530af1578637 authored by Peter Maydell on 16 October 2018, 17:09:38 UTC, committed by Kevin Wolf on 05 November 2018, 14:09:54 UTC
Taking the address of a field in a packed struct is a bad idea, because
it might not be actually aligned enough for that pointer type (and
thus cause a crash on dereference on some host architectures). Newer
versions of clang warn about this. Avoid the bug by not using the
"modify in place" byte swapping functions.

There are a few places where the in-place swap function is
used on something other than a packed struct field; we convert
those anyway, for consistency.

Patch produced with scripts/coccinelle/inplace-byteswaps.cocci.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1 parent c317b64
History
File Mode Size
COPYRIGHT -rw-r--r-- 2.8 KB
Makefile.objs -rw-r--r-- 330 bytes
arp_table.c -rw-r--r-- 3.3 KB
bootp.c -rw-r--r-- 10.9 KB
bootp.h -rw-r--r-- 3.1 KB
cksum.c -rw-r--r-- 4.5 KB
debug.h -rw-r--r-- 865 bytes
dhcpv6.c -rw-r--r-- 6.8 KB
dhcpv6.h -rw-r--r-- 738 bytes
dnssearch.c -rw-r--r-- 8.2 KB
if.c -rw-r--r-- 6.1 KB
if.h -rw-r--r-- 551 bytes
ip.h -rw-r--r-- 6.9 KB
ip6.h -rw-r--r-- 4.5 KB
ip6_icmp.c -rw-r--r-- 12.7 KB
ip6_icmp.h -rw-r--r-- 7.1 KB
ip6_input.c -rw-r--r-- 1.5 KB
ip6_output.c -rw-r--r-- 840 bytes
ip_icmp.c -rw-r--r-- 13.1 KB
ip_icmp.h -rw-r--r-- 6.3 KB
ip_input.c -rw-r--r-- 16.6 KB
ip_output.c -rw-r--r-- 4.8 KB
libslirp.h -rw-r--r-- 1.9 KB
main.h -rw-r--r-- 1.1 KB
mbuf.c -rw-r--r-- 5.0 KB
mbuf.h -rw-r--r-- 4.5 KB
misc.c -rw-r--r-- 8.6 KB
misc.h -rw-r--r-- 1.2 KB
ncsi-pkt.h -rw-r--r-- 21.0 KB
ncsi.c -rw-r--r-- 5.1 KB
ndp_table.c -rw-r--r-- 3.1 KB
sbuf.c -rw-r--r-- 4.0 KB
sbuf.h -rw-r--r-- 814 bytes
slirp.c -rw-r--r-- 45.7 KB
slirp.h -rw-r--r-- 7.0 KB
slirp_config.h -rw-r--r-- 1.9 KB
socket.c -rw-r--r-- 23.3 KB
socket.h -rw-r--r-- 5.1 KB
tcp.h -rw-r--r-- 6.0 KB
tcp_input.c -rw-r--r-- 44.9 KB
tcp_output.c -rw-r--r-- 15.2 KB
tcp_subr.c -rw-r--r-- 27.6 KB
tcp_timer.c -rw-r--r-- 8.6 KB
tcp_timer.h -rw-r--r-- 5.3 KB
tcp_var.h -rw-r--r-- 6.5 KB
tcpip.h -rw-r--r-- 3.8 KB
tftp.c -rw-r--r-- 11.1 KB
tftp.h -rw-r--r-- 939 bytes
udp.c -rw-r--r-- 9.0 KB
udp.h -rw-r--r-- 3.3 KB
udp6.c -rw-r--r-- 4.3 KB

back to top