qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] vmstate: fix vmstate_load_state for subsections


From: TeLeMan
Subject: [Qemu-devel] [PATCH] vmstate: fix vmstate_load_state for subsections
Date: Tue, 10 Aug 2010 17:22:11 +0800

If one vmstate includes subsections and its last field flag is
VMS_STRUCT, vmstate_load_state will be always failed when the
subsections exist. This fix is not perfect because if the last field
includes subsections too, vmstate_load_state will maybe be failed when
not all of the subsections exist. I think vmstate subsections needs to
be redesigned.

Signed-off-by: TeLeMan <address@hidden>
---
 savevm.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/savevm.c b/savevm.c
index 2082b8c..feca8fa 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1286,9 +1286,11 @@ int vmstate_load_state(QEMUFile *f, const
VMStateDescription *vmsd,
         }
         field++;
     }
-    ret = vmstate_subsection_load(f, vmsd, opaque);
-    if (ret != 0) {
-        return ret;
+    if (vmsd->subsections) {
+        ret = vmstate_subsection_load(f, vmsd, opaque);
+        if (ret != 0) {
+            return ret;
+        }
     }
     if (vmsd->post_load) {
         return vmsd->post_load(opaque, version_id);
-- 
1.6.5.1.1367.gcd48

--
SUN OF A BEACH



reply via email to

[Prev in Thread] Current Thread [Next in Thread]