qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 18/41] virtio: change config_len type to int32_t


From: Juan Quintela
Subject: [Qemu-devel] [PATCH 18/41] virtio: change config_len type to int32_t
Date: Wed, 2 Dec 2009 13:04:16 +0100

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 <address@hidden>
---
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]