Revision 091901841af285f963ea80cd18d616fd0350ddbc authored by Peter Maydell on 16 October 2018, 17:25:03 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.

There are other places where we take the address of a packed member
in this file for other purposes than passing it to a byteswap
function (all the calls to qemu_uuid_*()); we leave those for now.

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 1229e46
History
File Mode Size
aarch64
alpha
arm
cris
generic
host
hppa
i386
m68k
microblaze
mips
mips64
nios2
openrisc
ppc
riscv
s390x
sh4
sparc
sparc64
tilegx
x86_64
xtensa
Makefile.objs -rw-r--r-- 327 bytes
cpu_loop-common.h -rw-r--r-- 1.5 KB
elfload.c -rw-r--r-- 109.4 KB
errno_defs.h -rw-r--r-- 9.8 KB
exit.c -rw-r--r-- 1.0 KB
fd-trans.c -rw-r--r-- 41.5 KB
fd-trans.h -rw-r--r-- 3.0 KB
flat.h -rw-r--r-- 2.5 KB
flatload.c -rw-r--r-- 25.4 KB
ioctls.h -rw-r--r-- 22.5 KB
linux_loop.h -rw-r--r-- 2.6 KB
linuxload.c -rw-r--r-- 4.0 KB
m68k-sim.c -rw-r--r-- 4.7 KB
main.c -rw-r--r-- 23.3 KB
mmap.c -rw-r--r-- 22.9 KB
qemu.h -rw-r--r-- 25.9 KB
safe-syscall.S -rw-r--r-- 990 bytes
signal-common.h -rw-r--r-- 1.9 KB
signal.c -rw-r--r-- 31.1 KB
socket.h -rw-r--r-- 1.3 KB
strace.c -rw-r--r-- 71.5 KB
strace.list -rw-r--r-- 50.7 KB
syscall.c -rw-r--r-- 365.1 KB
syscall_defs.h -rw-r--r-- 82.0 KB
syscall_types.h -rw-r--r-- 10.0 KB
target_flat.h -rw-r--r-- 625 bytes
trace-events -rw-r--r-- 852 bytes
uaccess.c -rw-r--r-- 1.7 KB
uname.c -rw-r--r-- 4.7 KB
uname.h -rw-r--r-- 197 bytes
vm86.c -rw-r--r-- 15.9 KB

back to top