qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 95/97] vmstate: Create VMS_VBUFFER_UINT32


From: Juan Quintela
Subject: [Qemu-devel] [PATCH 95/97] vmstate: Create VMS_VBUFFER_UINT32
Date: Mon, 7 Apr 2014 05:21:53 +0200

We were dereferencing an uint32_t as int32_t.

Signed-off-by: Juan Quintela <address@hidden>
---
 include/migration/vmstate.h | 3 ++-
 vmstate.c                   | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 6c503d9..976d83e 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -97,6 +97,7 @@ enum VMStateFlags {
     VMS_ARRAY_OF_POINTER = 0x040,
     VMS_VARRAY_UINT16    = 0x080,  /* Array with size in uint16_t field */
     VMS_VBUFFER          = 0x100,  /* Buffer with size in int32_t field */
+    VMS_VBUFFER_UINT32   = 0x200,  /* Buffer with size in uint32_t field */
     VMS_VARRAY_UINT8     = 0x400,  /* Array with size in uint8_t field*/
     VMS_VARRAY_UINT32    = 0x800,  /* Array with size in uint32_t field*/
 };
@@ -443,7 +444,7 @@ extern const VMStateInfo vmstate_info_bitmap;
     .name         = (stringify(_field)),                             \
     .size_offset  = vmstate_offset_value(_state, _field_size, uint32_t),\
     .info         = &vmstate_info_buffer,                            \
-    .flags        = VMS_VBUFFER|VMS_POINTER,                         \
+    .flags        = VMS_VBUFFER_UINT32|VMS_POINTER,                  \
     .offset       = offsetof(_state, _field),                        \
 }

diff --git a/vmstate.c b/vmstate.c
index ca6691b..da5c49d 100644
--- a/vmstate.c
+++ b/vmstate.c
@@ -35,6 +35,8 @@ static int vmstate_size(void *opaque, VMStateField *field)

     if (field->flags & VMS_VBUFFER) {
         size = *(int32_t *)(opaque+field->size_offset);
+    } else if (field->flags & VMS_VBUFFER_UINT32) {
+        size = *(uint32_t *)(opaque+field->size_offset);
     }

     return size;
-- 
1.9.0




reply via email to

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