size_t changes between 32 and 64 bits, making it bad for a field that needs to be on the 'wire'. This value will never be near int32_t limit.
Stored values are very small ints, it is backwards compatible Signed-off-by: Juan Quintela <quint...@redhat.com> --- hw/virtio.c | 4 ++-- hw/virtio.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/virtio.c b/hw/virtio.c index bb93e8c..fd617ff 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -640,7 +640,7 @@ void virtio_save(VirtIODevice *vdev, QEMUFile *f) qemu_put_8s(f, &vdev->isr); qemu_put_be16s(f, &vdev->queue_sel); qemu_put_be32s(f, &vdev->features); - qemu_put_be32(f, vdev->config_len); + qemu_put_sbe32s(f, &vdev->config_len); qemu_put_buffer(f, vdev->config, vdev->config_len); qemu_put_sbe32s(f, &vdev->num_pci_queues); @@ -697,7 +697,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f) qemu_get_8s(f, &vdev->isr); qemu_get_be16s(f, &vdev->queue_sel); qemu_get_be32s(f, &vdev->features); - vdev->config_len = qemu_get_be32(f); + qemu_get_sbe32s(f, &vdev->config_len); qemu_get_buffer(f, vdev->config, vdev->config_len); qemu_get_sbe32s(f, &vdev->num_pci_queues); diff --git a/hw/virtio.h b/hw/virtio.h index d849f44..f56f672 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -96,7 +96,7 @@ struct VirtIODevice uint8_t isr; uint16_t queue_sel; uint32_t features; - size_t config_len; + int32_t config_len; void *config; uint16_t config_vector; int nvectors; -- 1.6.5.2