Received: from eggs.gnu.org ([2001:4830:134:3::10]:54083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WClw9-0007Fe-41 for qemu-devel@nongnu.org; Mon, 10 Feb 2014 03:09:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WClw3-0000fK-1V for qemu-devel@nongnu.org; Mon, 10 Feb 2014 03:09:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WClw2-0000fG-PT for qemu-devel@nongnu.org; Mon, 10 Feb 2014 03:09:46 -0500 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 s1A89kEH013824 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 10 Feb 2014 03:09:46 -0500 Date: Mon, 10 Feb 2014 16:09:53 +0800 From: Fam Zheng Message-ID: <20140210080953.GM15707@T430.nay.redhat.com> References: <1391939335-31580-1-git-send-email-pbonzini@redhat.com> <1391939335-31580-12-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1391939335-31580-12-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH 11/20] qcow: correctly propagate errors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, mreitz@redhat.com On Sun, 02/09 10:48, Paolo Bonzini wrote: > Signed-off-by: Paolo Bonzini > --- > block/qcow.c | 16 ++++++---------- > 1 file changed, 6 insertions(+), 10 deletions(-) > > diff --git a/block/qcow.c b/block/qcow.c > index 948b0c5..23bc691 100644 > --- a/block/qcow.c > +++ b/block/qcow.c > @@ -119,17 +119,19 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags, > if (header.version != QCOW_VERSION) { > char version[64]; > snprintf(version, sizeof(version), "QCOW version %d", header.version); > - qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, > - bs->device_name, "qcow", version); > + error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, > + bs->device_name, "qcow", version); > ret = -ENOTSUP; > goto fail; > } > > if (header.size <= 1 || header.cluster_bits < 9) { > + error_setg(errp, "invalid value in qcow header\n"); The convention is not adding "\n" in the end of error messages. > ret = -EINVAL; > goto fail; > } > if (header.crypt_method > QCOW_CRYPT_AES) { > + error_setg(errp, "invalid encryption method in qcow header\n"); Same here. Thanks, Fam