From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xd1il-0005vR-3Y for qemu-devel@nongnu.org; Sat, 11 Oct 2014 14:48:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xd1ie-0007r7-Rv for qemu-devel@nongnu.org; Sat, 11 Oct 2014 14:48:50 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:47590 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xd1ie-0007qT-LQ for qemu-devel@nongnu.org; Sat, 11 Oct 2014 14:48:44 -0400 Date: Sat, 11 Oct 2014 20:46:11 +0200 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20141011184611.GA7688@irqsave.net> References: <1408215258-12545-1-git-send-email-mreitz@redhat.com> <1408215258-12545-3-git-send-email-mreitz@redhat.com> <20141010120347.GC10091@irqsave.net> <5438FE24.5000107@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <5438FE24.5000107@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 2/3] qemu-io: Respect early image end for map List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: =?iso-8859-1?Q?Beno=EEt?= Canet , Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi The Saturday 11 Oct 2014 =E0 11:53:40 (+0200), Max Reitz wrote : > Am 10.10.2014 um 14:03 schrieb Beno=EEt Canet: > >>+ } else if (!num) { > >>+ error_report("Unexpected end of image"); > >>+ return 0; > >I think this test can miss some case of Unexpected end of image. > > > >For example supose that in map_is_allocated the first bdrv_is_allocate= d > >actually succeed then *pnum =3D num. Then the bottom loop has exit on = failure > >and the function return. > > > >in map_f &num is map_is_allocated *pnum so map_f's num !=3D 0 and this= very test > >fails to see the unexpected end of image error. >=20 > num !=3D 0 because some sectors where successfully queried. In my opini= on, we > should print the information about them we have. Then, the do-while loo= p is > repeated; and this time, map_is_allocated() either again returns num > = 0 > (for whatever reason, but I'd be fine with it) or, more probably, it'll= be > num =3D=3D 0 this time. So the error is not missed, it's just printed o= ne > iteration later. Ok that make sense. Best regards Beno=EEt >=20 > Max >=20 > >Best regards > > > >Beno=EEt > > > >> } > >> retstr =3D ret ? " allocated" : "not allocated"; > >>--=20 > >>2.0.4 > >> > >> >=20 >=20