summaryrefslogtreecommitdiffstats
path: root/include/qemu/compiler.h
diff options
context:
space:
mode:
authorPeter Maydell2018-09-25 18:19:24 +0200
committerDr. David Alan Gilbert2018-09-26 18:29:01 +0200
commit341ba0df4c69269cac839ddbacb2a0ca641a856d (patch)
tree00b38ae09dfa161c6684efc99a5c4d6c06b485d5 /include/qemu/compiler.h
parentmigration: fix the compression code (diff)
downloadqemu-341ba0df4c69269cac839ddbacb2a0ca641a856d.tar.gz
qemu-341ba0df4c69269cac839ddbacb2a0ca641a856d.tar.xz
qemu-341ba0df4c69269cac839ddbacb2a0ca641a856d.zip
migration/ram.c: Avoid taking address of fields in packed MultiFDInit_t struct
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: migration/ram.c:651:19: warning: taking address of packed member 'magic' of class or structure 'MultiFDInit_t' may result in an unaligned pointer value [-Waddress-of-packed-member] migration/ram.c:652:19: warning: taking address of packed member 'version' of class or structure 'MultiFDInit_t' may result in an unaligned pointer value [-Waddress-of-packed-member] migration/ram.c:737:19: warning: taking address of packed member 'magic' of class or structure 'MultiFDPacket_t' may result in an unaligned pointer value [-Waddress-of-packed-member] migration/ram.c:745:19: warning: taking address of packed member 'version' of class or structure 'MultiFDPacket_t' may result in an unaligned pointer value [-Waddress-of-packed-member] migration/ram.c:755:19: warning: taking address of packed member 'size' of class or structure 'MultiFDPacket_t' may result in an unaligned pointer value [-Waddress-of-packed-member] Avoid the bug by not using the "modify in place" byteswapping functions. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180925161924.7832-1-peter.maydell@linaro.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'include/qemu/compiler.h')
0 files changed, 0 insertions, 0 deletions