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
freebsd
i386
netbsd
openbsd
sparc
sparc64
x86_64
Makefile.objs -rw-r--r-- 91 bytes
bsd-mman.h -rw-r--r-- 6.3 KB
bsdload.c -rw-r--r-- 4.1 KB
elfload.c -rw-r--r-- 46.9 KB
errno_defs.h -rw-r--r-- 9.2 KB
main.c -rw-r--r-- 35.0 KB
mmap.c -rw-r--r-- 14.3 KB
qemu.h -rw-r--r-- 14.3 KB
signal.c -rw-r--r-- 898 bytes
strace.c -rw-r--r-- 6.8 KB
syscall.c -rw-r--r-- 16.4 KB
syscall_defs.h -rw-r--r-- 5.6 KB
uaccess.c -rw-r--r-- 1.7 KB

back to top