On Mon, Mar 24, 2014 at 04:38:01PM +0200, Michael S. Tsirkin wrote: > Can be used to verify a required field exists or validate > state in some other way. > > Signed-off-by: Michael S. Tsirkin <m...@redhat.com>
Sent a wrong patch. this is RFC in any case so not resending everything, but this is needed on top both to build and make the intent clear: diff --git a/vmstate.c b/vmstate.c index 4943b83..974c618 100644 --- a/vmstate.c +++ b/vmstate.c @@ -105,11 +105,11 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, return ret; } } + } else if (field->flags & VMS_MUST_EXIST) { + fprintf(stderr, "Input validation failed: %s/%s\n", vmsd->name, field->name); + return -1; } field++; - } else if (field->flags & VMS_MUST_EXIST) { - fprintf(stderr, "Input validation failed: %s/%s\n", vmsd->name, field->name); - return -1; } ret = vmstate_subsection_load(f, vmsd, opaque); if (ret != 0) {