From patchwork Wed Dec 18 02:26:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tuguoyi X-Patchwork-Id: 11299361 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7EE8A17F0 for ; Wed, 18 Dec 2019 02:27:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EA2E924672 for ; Wed, 18 Dec 2019 02:27:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA2E924672 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=h3c.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihP3j-0003SH-Pe for patchwork-qemu-devel@patchwork.kernel.org; Tue, 17 Dec 2019 21:27:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39517) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihP3F-0002v0-Cv for qemu-devel@nongnu.org; Tue, 17 Dec 2019 21:27:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihP3E-0004bW-4D for qemu-devel@nongnu.org; Tue, 17 Dec 2019 21:27:01 -0500 Received: from smtp.h3c.com ([60.191.123.50]:60822 helo=h3cspam02-ex.h3c.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ihP3D-0004Gg-Ib; Tue, 17 Dec 2019 21:27:00 -0500 Received: from DAG2EX09-IDC.srv.huawei-3com.com ([10.8.0.72]) by h3cspam02-ex.h3c.com with ESMTPS id xBI2QTrF012617 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 18 Dec 2019 10:26:29 +0800 (GMT-8) (envelope-from tu.guoyi@h3c.com) Received: from DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) by DAG2EX09-IDC.srv.huawei-3com.com (10.8.0.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 18 Dec 2019 10:26:28 +0800 Received: from DAG2EX03-BASE.srv.huawei-3com.com ([fe80::5d18:e01c:bbbd:c074]) by DAG2EX03-BASE.srv.huawei-3com.com ([fe80::5d18:e01c:bbbd:c074%6]) with mapi id 15.01.1713.004; Wed, 18 Dec 2019 10:26:28 +0800 From: Tuguoyi To: Kevin Wolf , Max Reitz , "qemu-block@nongnu.org" Subject: [PATCH] qcow2: Move error check of local_err near its assignment Thread-Topic: [PATCH] qcow2: Move error check of local_err near its assignment Thread-Index: AdW1Sk9pyaSaCMAlRUyLwKs8KWho0g== Date: Wed, 18 Dec 2019 02:26:20 +0000 Message-ID: Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.125.108.112] x-sender-location: DAG2 MIME-Version: 1.0 X-DNSRBL: X-MAIL: h3cspam02-ex.h3c.com xBI2QTrF012617 X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 60.191.123.50 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "qemu-devel@nongnu.org" Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Guoyi Tu Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/qcow2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 7c18721..ce3db29 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1705,14 +1705,14 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, if (!(bdrv_get_flags(bs) & BDRV_O_INACTIVE)) { /* It's case 1, 2 or 3.2. Or 3.1 which is BUG in management layer. */ bool header_updated = qcow2_load_dirty_bitmaps(bs, &local_err); + if (local_err != NULL) { + error_propagate(errp, local_err); + ret = -EINVAL; + goto fail; + } update_header = update_header && !header_updated; } - if (local_err != NULL) { - error_propagate(errp, local_err); - ret = -EINVAL; - goto fail; - } if (update_header) { ret = qcow2_update_header(bs);