mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
migration: Check field save returns
Check the return values from vmstate_save_state for fields and also the return values from 'put' for fields that use that. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-Id: <20170925112917.21340-4-dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
551dbd0846
commit
88b0faf185
1 changed files with 12 additions and 3 deletions
|
@ -347,6 +347,7 @@ int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
|
|||
}
|
||||
for (i = 0; i < n_elems; i++) {
|
||||
void *curr_elem = first_elem + size * i;
|
||||
ret = 0;
|
||||
|
||||
vmsd_desc_field_start(vmsd, vmdesc_loop, field, i, n_elems);
|
||||
old_offset = qemu_ftell_fast(f);
|
||||
|
@ -357,11 +358,19 @@ int vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
|
|||
if (!curr_elem && size) {
|
||||
/* if null pointer write placeholder and do not follow */
|
||||
assert(field->flags & VMS_ARRAY_OF_POINTER);
|
||||
vmstate_info_nullptr.put(f, curr_elem, size, NULL, NULL);
|
||||
ret = vmstate_info_nullptr.put(f, curr_elem, size, NULL,
|
||||
NULL);
|
||||
} else if (field->flags & VMS_STRUCT) {
|
||||
vmstate_save_state(f, field->vmsd, curr_elem, vmdesc_loop);
|
||||
ret = vmstate_save_state(f, field->vmsd, curr_elem,
|
||||
vmdesc_loop);
|
||||
} else {
|
||||
field->info->put(f, curr_elem, size, field, vmdesc_loop);
|
||||
ret = field->info->put(f, curr_elem, size, field,
|
||||
vmdesc_loop);
|
||||
}
|
||||
if (ret) {
|
||||
error_report("Save of field %s/%s failed",
|
||||
vmsd->name, field->name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
written_bytes = qemu_ftell_fast(f) - old_offset;
|
||||
|
|
Loading…
Reference in a new issue