From patchwork Sun Oct 9 19:50:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 118613 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 02ADBB6FA0 for ; Mon, 10 Oct 2011 06:52:31 +1100 (EST) Received: from localhost ([::1]:33202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCzQ9-0001LD-Sh for incoming@patchwork.ozlabs.org; Sun, 09 Oct 2011 15:52:25 -0400 Received: from eggs.gnu.org ([140.186.70.92]:37447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCzPz-00019R-M7 for qemu-devel@nongnu.org; Sun, 09 Oct 2011 15:52:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RCzPx-0004pP-Vh for qemu-devel@nongnu.org; Sun, 09 Oct 2011 15:52:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RCzPx-0004p3-OH for qemu-devel@nongnu.org; Sun, 09 Oct 2011 15:52:13 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p99JqCTU023037 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 9 Oct 2011 15:52:12 -0400 Received: from neno.neno (ovpn-116-17.ams2.redhat.com [10.36.116.17]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p99Joroq007860; Sun, 9 Oct 2011 15:52:03 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Sun, 9 Oct 2011 21:50:03 +0200 Message-Id: <8ce4c4095af1eeb1c57cbccf46ce9a980379e488.1318189536.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: Juan Quintela Subject: [Qemu-devel] [PATCH 5/5] Revert "savevm: fix corruption in vmstate_subsection_load()." X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This reverts commit eb60260de0b050a5e8ab725e84d377d0b44c43ae. Conflicts: savevm.c We changed qemu_peek_byte() prototype, just fixed the rejects. Signed-off-by: Juan Quintela Reviewed-by: Anthony Liguori Signed-off-by: Juan Quintela --- savevm.c | 10 +--------- 1 files changed, 1 insertions(+), 9 deletions(-) diff --git a/savevm.c b/savevm.c index ad58e7c..13686e4 100644 --- a/savevm.c +++ b/savevm.c @@ -1704,12 +1704,6 @@ static const VMStateDescription *vmstate_get_subsection(const VMStateSubsection static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, void *opaque) { - const VMStateSubsection *sub = vmsd->subsections; - - if (!sub || !sub->needed) { - return 0; - } - while (qemu_peek_byte(f, 0) == QEMU_VM_SUBSECTION) { char idstr[256]; int ret; @@ -1731,7 +1725,7 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, /* it don't have a valid subsection name */ return 0; } - sub_vmsd = vmstate_get_subsection(sub, idstr); + sub_vmsd = vmstate_get_subsection(vmsd->subsections, idstr); if (sub_vmsd == NULL) { return -ENOENT; } @@ -1740,7 +1734,6 @@ static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd, qemu_file_skip(f, len); /* idstr */ version_id = qemu_get_be32(f); - assert(!sub_vmsd->subsections); ret = vmstate_load_state(f, sub_vmsd, opaque, version_id); if (ret) { return ret; @@ -1764,7 +1757,6 @@ static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd, qemu_put_byte(f, len); qemu_put_buffer(f, (uint8_t *)vmsd->name, len); qemu_put_be32(f, vmsd->version_id); - assert(!vmsd->subsections); vmstate_save_state(f, vmsd, opaque); } sub++;