From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O4Ki4-00079x-KV for qemu-devel@nongnu.org; Tue, 20 Apr 2010 17:10:20 -0400 Received: from [140.186.70.92] (port=37317 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4Ki2-00079C-I9 for qemu-devel@nongnu.org; Tue, 20 Apr 2010 17:10:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O4Khz-0003wo-8v for qemu-devel@nongnu.org; Tue, 20 Apr 2010 17:10:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46825) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4Khw-0003w8-OR for qemu-devel@nongnu.org; Tue, 20 Apr 2010 17:10:15 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3KLABLe020538 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 20 Apr 2010 17:10:11 -0400 From: Luiz Capitulino Date: Tue, 20 Apr 2010 18:09:36 -0300 Message-Id: <1271797792-24571-7-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1271797792-24571-1-git-send-email-lcapitulino@redhat.com> References: <1271797792-24571-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 06/22] savevm: load_vmstate(): Improve error check List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, armbru@redhat.com, quintela@redhat.com, kwolf@redhat.com We should fail if something goes wrong in the call to bdrv_snapshot_find(). Currently, we only fail if 'sn.vm_state_size' is not what we expect it to be. Signed-off-by: Luiz Capitulino --- savevm.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/savevm.c b/savevm.c index 5024829..3ccb246 100644 --- a/savevm.c +++ b/savevm.c @@ -1800,8 +1800,11 @@ int load_vmstate(const char *name) /* Don't even try to load empty VM states */ ret = bdrv_snapshot_find(bs, &sn, name); - if ((ret >= 0) && (sn.vm_state_size == 0)) + if (ret < 0) { + return ret; + } else if (sn.vm_state_size == 0) { return -EINVAL; + } /* restore the VM state */ f = qemu_fopen_bdrv(bs, 0); -- 1.7.1.rc1.12.ga6018