Skip to contentSkip to conversation

vmstate: fix varrays with uint32_t indexes

PATCH RESEND Applied Amos Kong 5 participants 6 messages Mar 13, 2012 – Mar 17, 2012

lore
Share & tools
lore

Amos Kong

author
#0 lore raw

PATCH RESEND 1/1 vmstate: fix varrays with uint32_t indexes

VMSTATE_VARRAY_UINT32() is used in hw/ds1225y.c, and we checked VMS_VARRAY_UINT32 bit of field->flags in vmstate_load_state(), but we don't check this bit in vmstate_save_state().

---
 savevm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
savevm.c +2 -0
index 80be1ff..694eaa4 100644
@@ -1486,6 +1486,8 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
                 n_elems = field->num;
             } else if (field->flags & VMS_VARRAY_INT32) {
                 n_elems = *(int32_t *)(opaque+field->num_offset);
+            } else if (field->flags & VMS_VARRAY_UINT32) {
+                n_elems = *(uint32_t *)(opaque+field->num_offset);
             } else if (field->flags & VMS_VARRAY_UINT16) {
                 n_elems = *(uint16_t *)(opaque+field->num_offset);
             } else if (field->flags & VMS_VARRAY_UINT8) {
#2 lore raw
In reply to Amos Kong

Am 13.03.2012 07:05, schrieb Amos Kong:

Quoted 3 lines

VMSTATE_VARRAY_UINT32() is used in hw/ds1225y.c, and we checked VMS_VARRAY_UINT32 bit of field->flags in vmstate_load_state(), but we don't check this bit in vmstate_save_state().

So what were the symptoms? Does this need to be backported to stable?

Andreas

Quoted 19 lines
---
 savevm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
savevm.c +2 -0
index 80be1ff..694eaa4 100644
@@ -1486,6 +1486,8 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
                 n_elems = field->num;
             } else if (field->flags & VMS_VARRAY_INT32) {
                 n_elems = *(int32_t *)(opaque+field->num_offset);
+            } else if (field->flags & VMS_VARRAY_UINT32) {
+                n_elems = *(uint32_t *)(opaque+field->num_offset);
             } else if (field->flags & VMS_VARRAY_UINT16) {
                 n_elems = *(uint16_t *)(opaque+field->num_offset);
             } else if (field->flags & VMS_VARRAY_UINT8) {
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#3 lore raw
Quoted 6 lines · Andreas Färber

Am 13.03.2012 07:05, schrieb Amos Kong:

Quoted 3 lines

VMSTATE_VARRAY_UINT32() is used in hw/ds1225y.c, and we checked VMS_VARRAY_UINT32 bit of field->flags in vmstate_load_state(), but we don't check this bit in vmstate_save_state().

So what were the symptoms? Does this need to be backported to stable?

You don't initialize n_elems correctly when saving.

It is only used (currently) with ds1225y.c, that is used on mips_jazz, and mips_jazz don't support migration. So it is up to you if it is needed for stable or not (it is not urgent, though).

Later, Juan.

Quoted 21 lines

Andreas

Quoted 19 lines
---
 savevm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
savevm.c +2 -0
index 80be1ff..694eaa4 100644
@@ -1486,6 +1486,8 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
                 n_elems = field->num;
             } else if (field->flags & VMS_VARRAY_INT32) {
                 n_elems = *(int32_t *)(opaque+field->num_offset);
+            } else if (field->flags & VMS_VARRAY_UINT32) {
+                n_elems = *(uint32_t *)(opaque+field->num_offset);
             } else if (field->flags & VMS_VARRAY_UINT16) {
                 n_elems = *(uint16_t *)(opaque+field->num_offset);
             } else if (field->flags & VMS_VARRAY_UINT8) {
Applied
#5 lore raw
In reply to Amos Kong

Thanks, applied.

Quoted 23 lines · Amos Kong

VMSTATE_VARRAY_UINT32() is used in hw/ds1225y.c, and we checked VMS_VARRAY_UINT32 bit of field->flags in vmstate_load_state(), but we don't check this bit in vmstate_save_state().

---
 savevm.c |    2 ++

 1 files changed, 2 insertions(+), 0 deletions(-)
savevm.c +2 -0
index 80be1ff..694eaa4 100644
@@ -1486,6 +1486,8 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
                 n_elems = field->num;
             } else if (field->flags & VMS_VARRAY_INT32) {
                 n_elems = *(int32_t *)(opaque+field->num_offset);
+            } else if (field->flags & VMS_VARRAY_UINT32) {
+                n_elems = *(uint32_t *)(opaque+field->num_offset);
             } else if (field->flags & VMS_VARRAY_UINT16) {
                 n_elems = *(uint16_t *)(opaque+field->num_offset);
             } else if (field->flags & VMS_VARRAY_UINT8) {