From patchwork Wed Jul 28 04:37:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: TeLeMan X-Patchwork-Id: 60083 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 02425B6EE9 for ; Wed, 28 Jul 2010 14:39:46 +1000 (EST) Received: from localhost ([127.0.0.1]:37725 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdyQh-0007Dn-5n for incoming@patchwork.ozlabs.org; Wed, 28 Jul 2010 00:39:43 -0400 Received: from [140.186.70.92] (port=32982 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdyOe-0006cW-44 for qemu-devel@nongnu.org; Wed, 28 Jul 2010 00:37:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdyOc-0006Uh-3d for qemu-devel@nongnu.org; Wed, 28 Jul 2010 00:37:36 -0400 Received: from mail-vw0-f45.google.com ([209.85.212.45]:62938) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdyOc-0006UF-13 for qemu-devel@nongnu.org; Wed, 28 Jul 2010 00:37:34 -0400 Received: by vws19 with SMTP id 19so4121637vws.4 for ; Tue, 27 Jul 2010 21:37:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=FE8HYKz+O12Hr4hgMClbtQAoqFJAFDNdQZQipA0T4K0=; b=iZpbpWVU0p7SY+WaWC6TQuYyNEyZvuxKFRr+OtdbPYJZ8Wb7EABfyyVJ/Jk4eQEXL5 1T3Vo//Qr8B0qS11tioM6R16/WEMGtQ4EV38hJZJSIgJ9oS5HM+dR7AicUEi+nlYpxRa 9dpqI7LudT8Kljj/DwVVpF/ib//zzIhfDxwvc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=xUb77jlHS8dLmKT+MRV9wMaya7ba/7puKrVqGmHmYACPU44Kur36T6NSr1uGeEcDkq iTpK2364rlTiz+ojYvyRwfd+tFgEf6kyVOM1eGBpJSGWpWWTr31niUzFkafqeElzhFs8 lhjgA8RzNryhexb8ggA9qxd4thBoeno/9mZ9A= MIME-Version: 1.0 Received: by 10.220.49.204 with SMTP id w12mr5774326vcf.103.1280291852239; Tue, 27 Jul 2010 21:37:32 -0700 (PDT) Received: by 10.220.190.4 with HTTP; Tue, 27 Jul 2010 21:37:32 -0700 (PDT) Date: Wed, 28 Jul 2010 12:37:32 +0800 Message-ID: From: TeLeMan To: Juan Quintela , qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Subject: [Qemu-devel] [PATCH] vmstate: fix vmstate_subsection_load X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org If the new version adds the new subsection for some vmstate, the old version will load the new version's vmstate unsuccessfully. So we have to ignore the unrecognized subsections. Signed-off-by: TeLeMan --- savevm.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) return 0; diff --git a/savevm.c b/savevm.c index 9a8328d..3e1aa73 100644 --- a/savevm.c +++ b/savevm.c @@ -1581,12 +1581,11 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, version_id = qemu_get_be32(f); sub_vmsd = vmstate_get_subsection(vmsd->subsections, idstr); - if (sub_vmsd == NULL) { - return -ENOENT; - } - ret = vmstate_load_state(f, sub_vmsd, opaque, version_id); - if (ret) { - return ret; + if (sub_vmsd) { + ret = vmstate_load_state(f, sub_vmsd, opaque, version_id); + if (ret) { + return ret; + } } }