diff mbox

[RESEND] vmstate: fix varrays with uint32_t indexes

Message ID 20120313060536.7941.37036.stgit@dhcp-8-167.nay.redhat.com
State Under Review
Headers show

Commit Message

Amos Kong March 13, 2012, 6:05 a.m. UTC
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().

Signed-off-by: Amos Kong <akong@redhat.com>
---
 savevm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Juan Quintela March 13, 2012, 2:49 p.m. UTC | #1
Amos Kong <akong@redhat.com> wrote:
> 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().
>
> Signed-off-by: Amos Kong <akong@redhat.com>

Acked-by: Juan Quintela <quintela@redhat.com>
Andreas Färber March 13, 2012, 4:38 p.m. UTC | #2
Am 13.03.2012 07:05, schrieb 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().

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

Andreas

> 
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  savevm.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/savevm.c b/savevm.c
> index 80be1ff..694eaa4 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -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) {
Juan Quintela March 13, 2012, 5:46 p.m. UTC | #3
Andreas Färber <afaerber@suse.de> wrote:
> Am 13.03.2012 07:05, schrieb 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().
>
> 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.


> Andreas
>
>> 
>> Signed-off-by: Amos Kong <akong@redhat.com>
>> ---
>>  savevm.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>> 
>> diff --git a/savevm.c b/savevm.c
>> index 80be1ff..694eaa4 100644
>> --- a/savevm.c
>> +++ b/savevm.c
>> @@ -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) {
Hervé Poussineau March 14, 2012, 6:19 a.m. UTC | #4
Amos Kong a écrit :
> 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().
> 
> Signed-off-by: Amos Kong <akong@redhat.com>

Acked-by: Hervé Poussineau <hpoussin@reactos.org>
Blue Swirl March 17, 2012, 4:20 p.m. UTC | #5
Thanks, applied.

On Tue, Mar 13, 2012 at 06:05, Amos Kong <akong@redhat.com> wrote:
> 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().
>
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  savevm.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/savevm.c b/savevm.c
> index 80be1ff..694eaa4 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -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) {
>
diff mbox

Patch

diff --git a/savevm.c b/savevm.c
index 80be1ff..694eaa4 100644
--- a/savevm.c
+++ b/savevm.c
@@ -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) {