[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 71/79] virtio: do not take address of packed members
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 71/79] virtio: do not take address of packed members |
Date: |
Sun, 30 Sep 2018 10:13:09 +0200 |
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 <address@hidden>
Cc: Peter Maydell <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/char/virtio-serial-bus.c | 6 +++---
1 file 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;
--
1.8.3.1
- [Qemu-devel] [PULL 70/79] replay: replay BH for IDE trim operation, (continued)
- [Qemu-devel] [PULL 70/79] replay: replay BH for IDE trim operation, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 57/79] i386: Compile CPUX86State xsave_buf only when support KVM or HVF, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 67/79] hvf: drop unused variable, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 69/79] hostmem-file: make available memory-backend-file on POSIX-based hosts, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 63/79] scsi-block: Deprecate rotation_rate, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 72/79] memory: Use MAKE_64BIT_MASK(), Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 50/79] Revert "chardev: tcp: postpone TLS work until machine done", Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 74/79] memory: Fix access_with_adjusted_size(small size) on big-endian memory regions, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 76/79] hw/nvram/fw_cfg: Use memberwise copy of MemoryRegionOps struct, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 78/79] cpus: fix TCG kick timer leak, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 71/79] virtio: do not take address of packed members,
Paolo Bonzini <=
- [Qemu-devel] [PULL 66/79] qom/object: add some interface asserts, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 73/79] memory: Refactor common shifting code from accessors, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 77/79] docs/devel/memory.txt: Document _with_attrs accessors, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 68/79] target/i386: fix translation for icount mode, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 56/79] target/i386: rename HF_SVMI_MASK to HF_GUEST_MASK, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 64/79] lsi53c895a: convert to trace-events, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 79/79] hw/scsi/mptendian: Avoid taking address of fields in packed structs, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 55/79] target/i386: unify masking of interrupts, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 65/79] accel/tcg: Remove dead code, Paolo Bonzini, 2018/09/30
- [Qemu-devel] [PULL 75/79] memory: Remove old_mmio accessors, Paolo Bonzini, 2018/09/30