aboutsummaryrefslogtreecommitdiff
path: root/hw/char
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-09-26 23:17:42 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2018-10-02 19:09:13 +0200
commitd41ca5afe3bc513ecf10b3ba5aa59523e3cd54aa (patch)
treebc22418e7e5070b59caa1679638f436b94b33b36 /hw/char
parentb255df7e6ee2b6da7a54b62b8e6c145054fec0db (diff)
downloadqemu-d41ca5afe3bc513ecf10b3ba5aa59523e3cd54aa.zip
qemu-d41ca5afe3bc513ecf10b3ba5aa59523e3cd54aa.tar.gz
qemu-d41ca5afe3bc513ecf10b3ba5aa59523e3cd54aa.tar.bz2
virtio: do not take address of packed members
The address of a packed member is not packed, which may cause accesses to unaligned pointers. Avoid this by reading the packed value before passing it to another function. Cc: Jason Wang <jasowang@redhat.com> Cc: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/char')
-rw-r--r--hw/char/virtio-serial-bus.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index d2dd8ab..04e3ebe 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -667,9 +667,9 @@ static void virtio_serial_save_device(VirtIODevice *vdev, QEMUFile *f)
/* The config space (ignored on the far end in current versions) */
get_config(vdev, (uint8_t *)&config);
- qemu_put_be16s(f, &config.cols);
- qemu_put_be16s(f, &config.rows);
- qemu_put_be32s(f, &config.max_nr_ports);
+ qemu_put_be16(f, config.cols);
+ qemu_put_be16(f, config.rows);
+ qemu_put_be32(f, config.max_nr_ports);
/* The ports map */
max_nr_ports = s->serial.max_virtserial_ports;