hw/s390x/virtio-ccw.c: Don't take address of fields in packed structs
commitc9aacaadeb42076c01b07e59dd94dcf73f751e05
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 10 Dec 2018 12:04:36 +0000 (10 12:04 +0000)
committerCornelia Huck <cohuck@redhat.com>
Wed, 12 Dec 2018 09:39:28 +0000 (12 10:39 +0100)
tree78fa2e7fae44aa97e80439770b89c23588bfe854
parent1883e8fc8005e9ef452890a075bae98e8c432968
hw/s390x/virtio-ccw.c: Don't take address of fields in packed structs

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.

Patch produced with scripts/coccinelle/inplace-byteswaps.cocci
(with a couple of long lines manually wrapped).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20181210120436.30522-1-peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
hw/s390x/virtio-ccw.c