From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7kmv-0002FM-DW for qemu-devel@nongnu.org; Tue, 31 May 2016 10:36:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7kmt-0007wE-By for qemu-devel@nongnu.org; Tue, 31 May 2016 10:36:56 -0400 References: <1464694565-16784-1-git-send-email-clg@kaod.org> <574D9F0F.7060904@redhat.com> <574D9FBB.60100@kaod.org> From: Eric Blake Message-ID: <574DA17D.5070505@redhat.com> Date: Tue, 31 May 2016 08:36:45 -0600 MIME-Version: 1.0 In-Reply-To: <574D9FBB.60100@kaod.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sHS4h02wfEIKfPxOFhGojkoc4QM2tQnFj" Subject: Re: [Qemu-devel] [PATCH] m25p80: fix test on blk_pread() return value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Cc: Peter Crosthwaite , Kevin Wolf , Max Reitz , qemu-block@nongnu.org, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --sHS4h02wfEIKfPxOFhGojkoc4QM2tQnFj Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/31/2016 08:29 AM, C=C3=A9dric Le Goater wrote: > On 05/31/2016 04:26 PM, Eric Blake wrote: >> On 05/31/2016 05:36 AM, C=C3=A9dric Le Goater wrote: >>> commit 243e6f69c129 ("m25p80: Switch to byte-based block access") >>> replaced blk_read() calls with blk_pread() but return values are >>> different. >> >> Shoot, I completely missed that when I made the conversions. Now I ne= ed >> to re-audit that entire series to see if the same problem happened >> anywhere else. >=20 > I took a quick look and most of the calls to blk_pread() test with < 0.= =20 > So we should be fine and I should have mention that. >=20 > C.=20 >=20 >>> >>> Signed-off-by: C=C3=A9dric Le Goater >>> --- >>> hw/block/m25p80.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> Reviewed-by: Eric Blake >> >>> >>> Index: qemu-ast2400-mainline.git/hw/block/m25p80.c >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> --- qemu-ast2400-mainline.git.orig/hw/block/m25p80.c >>> +++ qemu-ast2400-mainline.git/hw/block/m25p80.c >>> @@ -900,7 +900,7 @@ static int m25p80_init(SSISlave *ss) >>> s->storage =3D blk_blockalign(s->blk, s->size); >>> =20 >>> /* FIXME: Move to late init */ >>> - if (blk_pread(s->blk, 0, s->storage, s->size)) { >>> + if (blk_pread(s->blk, 0, s->storage, s->size) !=3D s->size) = { As it is, blk_pread() (and blk_pwrite()) _always_ returns negative or the input count value; it appears that it is incapable of reporting a short read amount. I guess that's intentional, but a bit odd, when compared to the standard read()/write(). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --sHS4h02wfEIKfPxOFhGojkoc4QM2tQnFj Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXTaF9AAoJEKeha0olJ0NqU9sH/R/XIeHKCcPeCmzy+6jxZuKD 87zdq8KiT71SsE7IKlzcYVflLaek5BUt+7KZFL4MNztcdtjqFa/rSZIVLJ0G+CZD s9ukWB4sKbEfOyNCMQngT+fAp7yN51TwSToPztvsYVnbcT6cr5XY12q8l4IPBhIO 0i2qvnGILLuF5brEptj/T3K2+oUN5Uy0YB1b1hM8+XWfaOVIAh0xPEtBIEf7QCAq PWVPZj4OQPu7eUTjG1C6lkMFO/TaYPBDCXlhzc59Y3ip61N5jOovz1Ww6RgVTjs1 dduSJJB1ZWNOF2s9PfQFC+djlg35dGCJj30HzPZOIr4prIxIn5zIfbLACxYtGHU= =GwRT -----END PGP SIGNATURE----- --sHS4h02wfEIKfPxOFhGojkoc4QM2tQnFj--