diff options
author | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2017-09-25 12:29:14 +0100 |
---|---|---|
committer | Dr. David Alan Gilbert <dgilbert@redhat.com> | 2017-09-27 11:37:11 +0100 |
commit | 88b0faf1853937b87a35cae8c74e38971aff0bba (patch) | |
tree | 8ebbb76d399a94513c585989fcfeceaecb0a2a5d /migration/vmstate.c | |
parent | 551dbd0846d23e94dbc22dcfd9cf1f8dbbf403ad (diff) |
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>
Diffstat (limited to 'migration/vmstate.c')
-rw-r--r-- | migration/vmstate.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/migration/vmstate.c b/migration/vmstate.c index ae8abd3c32..848e8448c6 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -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; |