From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XctN4-0002Ik-Ol for qemu-devel@nongnu.org; Sat, 11 Oct 2014 05:54:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XctMy-0006ls-KP for qemu-devel@nongnu.org; Sat, 11 Oct 2014 05:53:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34006) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XctMy-0006lm-Cq for qemu-devel@nongnu.org; Sat, 11 Oct 2014 05:53:48 -0400 Message-ID: <5438FE24.5000107@redhat.com> Date: Sat, 11 Oct 2014 11:53:40 +0200 From: Max Reitz MIME-Version: 1.0 References: <1408215258-12545-1-git-send-email-mreitz@redhat.com> <1408215258-12545-3-git-send-email-mreitz@redhat.com> <20141010120347.GC10091@irqsave.net> In-Reply-To: <20141010120347.GC10091@irqsave.net> Content-Type: text/plain; charset=windows-1252; format=flowed 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: =?windows-1252?Q?Beno=EEt_Canet?= Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi 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_allocated > actually succeed then *pnum =3D num. Then the bottom loop has exit on f= ailure > 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. num !=3D 0 because some sectors where successfully queried. In my opinion= ,=20 we should print the information about them we have. Then, the do-while=20 loop is repeated; and this time, map_is_allocated() either again returns=20 num > 0 (for whatever reason, but I'd be fine with it) or, more=20 probably, it'll be num =3D=3D 0 this time. So the error is not missed, it= 's=20 just printed one iteration later. Max > Best regards > > Beno=EEt > >> } >> =20 >> retstr =3D ret ? " allocated" : "not allocated"; >> --=20 >> 2.0.4 >> >>