[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v2 3/5] vmstate: add VMS_MUST_EXIST
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [RFC v2 3/5] vmstate: add VMS_MUST_EXIST |
Date: |
Mon, 24 Mar 2014 18:21:25 +0200 |
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 <address@hidden>
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) {
[Qemu-devel] [RFC v2 4/5] vmstate: add VMSTATE_TEST, Michael S. Tsirkin, 2014/03/24
[Qemu-devel] [RFC v2 5/5] hpet: fix buffer overrun on invalid state load, Michael S. Tsirkin, 2014/03/24
Re: [Qemu-devel] [RFC v2 0/5] state loading security issues, Michael S. Tsirkin, 2014/03/24