From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33509) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOtpz-0007er-BT for qemu-devel@nongnu.org; Tue, 02 Sep 2014 15:34:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOtpu-0005e2-7c for qemu-devel@nongnu.org; Tue, 02 Sep 2014 15:33:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOtpt-0005dv-VE for qemu-devel@nongnu.org; Tue, 02 Sep 2014 15:33:50 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s82JXmnl007699 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 2 Sep 2014 15:33:48 -0400 Message-ID: <54061B9B.6020608@redhat.com> Date: Tue, 02 Sep 2014 13:33:47 -0600 From: Eric Blake MIME-Version: 1.0 References: <1409348727-17183-1-git-send-email-mreitz@redhat.com> <1409348727-17183-3-git-send-email-mreitz@redhat.com> <540100AB.4090004@redhat.com> <540613AB.1080305@redhat.com> In-Reply-To: <540613AB.1080305@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Hd1WhkM4QkA7BFopD4KpwGG99AWSNwL4O" Subject: Re: [Qemu-devel] [PATCH 2/2] docs/qcow2: Correct refcount_block_entries List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Hd1WhkM4QkA7BFopD4KpwGG99AWSNwL4O Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/02/2014 12:59 PM, Max Reitz wrote: >> Consider refcount_order =3D=3D 0 (that is, no shared blocks, ALL block= s have >> at most refcount 1). Then, refcount_bits is (1 << 0) =3D=3D 1. But 1= /8 in >> integer math truncates to 0 (oops, division by zero is undefined); whe= n >> in reality, the expression you want here is (cluster_size * 8 / >> refcount_bits). >=20 > If it is integer division, that is. ;-) >=20 > I'm counting on you accepting "cluster_size * 8 / refcount_bits" and no= t > rejecting it because of a possible integer overflow. *g* We already document that qemu's maximum cluster size is 2M; and 2M*8 is less than 32 bits :) Maybe the qcow2 spec allows the theoretical file with a cluster size of 512M, where overflow then matters. But you are correct that I won't reject your patch, given that qemu doesn't parse all possible theoretical qcow2 files :) --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Hd1WhkM4QkA7BFopD4KpwGG99AWSNwL4O 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 iQEcBAEBCAAGBQJUBhubAAoJEKeha0olJ0Nq4goH/R5y2dq2IQZAbBWwJS7C0pE4 zNjug9bRmEEoEEv3i6sN/W0q7DQ9Grb4kC/ou3eOiWt3fvEGh5JlerE4SOmRVolc n4nyKFsegL0dW33gaLHbNOAdZkKFsg4fgbd9rcdEWzgQbt8dyKoh5pde1MBvuv2S WFRlPg1NV+b9oNkhFN4WHynpnHyZwoG1ikzIo+slyvDkxLgqpl6oJWqWyx8tU45j jpVoy4olSsp4jiIYv7a9Wc6eyB+loTZ4tAKHYGxEEYFxA4JABFz89vfihH3V5Dtf L1vwXzF7O6Sp9U2dg9gskQG+GCh7msUUp3OOu3phDMomslZcQ0zLKaF5jDypZew= =vQkA -----END PGP SIGNATURE----- --Hd1WhkM4QkA7BFopD4KpwGG99AWSNwL4O--