From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnsNP-0007PV-SF for qemu-devel@nongnu.org; Mon, 10 Nov 2014 12:03:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XnsNK-0001ra-R0 for qemu-devel@nongnu.org; Mon, 10 Nov 2014 12:03:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45745) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnsNK-0001rN-In for qemu-devel@nongnu.org; Mon, 10 Nov 2014 12:03:34 -0500 Message-ID: <5460EFDB.7030407@redhat.com> Date: Mon, 10 Nov 2014 10:03:23 -0700 From: Eric Blake MIME-Version: 1.0 References: <1415627159-15941-1-git-send-email-mreitz@redhat.com> <1415627159-15941-10-git-send-email-mreitz@redhat.com> In-Reply-To: <1415627159-15941-10-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="QS16WflduFXWTVVB0FMxvbGXiopFEggkv" Subject: Re: [Qemu-devel] [PATCH 09/21] qcow2: Open images with refcount order != 4 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Lieven , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --QS16WflduFXWTVVB0FMxvbGXiopFEggkv Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/10/2014 06:45 AM, Max Reitz wrote: > No longer refuse to open images with a different refcount entry width > than 16 bits; only reject images with a refcount width larger than 64 > bits (which is prohibited by the specification). >=20 > Signed-off-by: Max Reitz > --- > block/qcow2.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/block/qcow2.c b/block/qcow2.c > index d70e927..b718e75 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -677,10 +677,10 @@ static int qcow2_open(BlockDriverState *bs, QDict= *options, int flags, > } > =20 > /* Check support for various header values */ > - if (header.refcount_order !=3D 4) { > - report_unsupported(bs, errp, "%d bit reference counts", > - 1 << header.refcount_order); > - ret =3D -ENOTSUP; > + if (header.refcount_order > 6) { > + error_setg(errp, "Reference count entry width too large (%i bi= t); may " > + "not exceed 64 bit", 1 << header.refcount_order); Overflows if I fuzz an image to put 32 or larger into header.refcount_order. It may be better to just tweak the error message to state that the order cannot exceed 6, rather than trying to display the actual bit width that the user is requesting, as then you avoid the '1 << problem'. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --QS16WflduFXWTVVB0FMxvbGXiopFEggkv 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUYO/bAAoJEKeha0olJ0NqATsH/i7ZGCptDYJZpjzzu5D8CML2 jVnhL1F96VLs4moFfCtZ6r1WMUTn4uF2GKtAKScmP8eUcPrXhZZsJq6/nd8z72Dx 8thagiTS2jR4rjIReR4A8sHc/1hXlgfBb33z5tSBCwtS8D0XP0RdGQgCeOLd9Erh Gvayo+eiw6dtKxfTnqtzg3tn3jjAliWKzRJdv6Hh5ozMVbrJ4HV+ywPVf5UlwhOw 3bE1JNHqMFmRUH4sunP8gW6fXk/3Lzh2M7eXlE7IladnQwzMRRo3J5E0JGeUYU1a qHUHlgkwbKGIDdSX6pKywn4DYwllSmsG+bvJRAdoULkxgL2NUhOFj2JRNrnMek4= =UiO4 -----END PGP SIGNATURE----- --QS16WflduFXWTVVB0FMxvbGXiopFEggkv--