From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYVwG-0006Oh-8N for qemu-devel@nongnu.org; Tue, 22 Oct 2013 02:59:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VYVwB-00029G-RK for qemu-devel@nongnu.org; Tue, 22 Oct 2013 02:59:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7998) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VYVwB-000298-Iy for qemu-devel@nongnu.org; Tue, 22 Oct 2013 02:59:31 -0400 Message-ID: <5266223D.4080507@redhat.com> Date: Tue, 22 Oct 2013 07:59:09 +0100 From: Eric Blake MIME-Version: 1.0 References: <1382424205-19742-1-git-send-email-pl@kamp.de> In-Reply-To: <1382424205-19742-1-git-send-email-pl@kamp.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xeCvUAvUO9UW1fa2Jnr1QtEuACVpKV3jA" Subject: Re: [Qemu-devel] [PATCH] block/vpc: check that the image has not been truncated List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven , qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, aliguori@us.ibm.com, jcody@redhat.com, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xeCvUAvUO9UW1fa2Jnr1QtEuACVpKV3jA Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 10/22/2013 07:43 AM, Peter Lieven wrote: > this adds a check that a dynamic VHD file has not been > accidently truncated (e.g. during transfer or upload). >=20 > Signed-off-by: Peter Lieven > --- > block/vpc.c | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/block/vpc.c b/block/vpc.c > index 1acc1d4..921364e 100644 > --- a/block/vpc.c > +++ b/block/vpc.c > @@ -269,6 +269,13 @@ static int vpc_open(BlockDriverState *bs, QDict *o= ptions, int flags, > } > } > =20 > + if (s->free_data_block_offset > bdrv_getlength(bs->file)) { > + ret =3D -EINVAL; > + fprintf(stderr, "block-vpc: free_data_block_offset points = after" > + "the end of file. the image has been trunc= ated.\n"); Why fprintf() instead of using the errp argument? Also, s/afterthe/after the/; s/file\. the/file. The/ --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --xeCvUAvUO9UW1fa2Jnr1QtEuACVpKV3jA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSZiI9AAoJEKeha0olJ0NqrrYH/2mnsCf5vpDE/MmNLq+KJALz 5m+hx75hXLrSTIyyNFCXKc7bTMrjNMDS/zM3dlfj4xMxE3dOaU/TKE4P/k/JtdOk Ev9VeTHZ1sTBrxOlreD2HhAggAxNKkuqu1hNnB2ecIZOGFzmOhhLnTa+5Oos06On yU3rS03V9EcVjArNvyRpcLGKlKjfbvu28MZK1VctXClgyHEHVAnW5U9IM1o//0uV KIHk1DX+SJdFun9bnL74AbHMzEM865952EuZZ/g+HtbRzIV66YebjvMowVVWqAtU 9/izjB/KIpZzeZ7dEmpT0bO2lhJkMGY1ohXU62+VzgD27LbuOi7tps1CGSzceJs= =tNzg -----END PGP SIGNATURE----- --xeCvUAvUO9UW1fa2Jnr1QtEuACVpKV3jA--