From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrHDS-0004WS-TR for qemu-devel@nongnu.org; Fri, 04 Jan 2013 19:02:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TrHDQ-0006mZ-MG for qemu-devel@nongnu.org; Fri, 04 Jan 2013 19:02:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:12195) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrHDQ-0006mU-Ew for qemu-devel@nongnu.org; Fri, 04 Jan 2013 19:02:20 -0500 Message-ID: <50E76D85.3060603@redhat.com> Date: Fri, 04 Jan 2013 17:02:13 -0700 From: Eric Blake MIME-Version: 1.0 References: <1357143393-29832-1-git-send-email-benoit@irqsave.net> <1357143393-29832-13-git-send-email-benoit@irqsave.net> In-Reply-To: <1357143393-29832-13-git-send-email-benoit@irqsave.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigB4840CACCD6E4C0157F2F427" Subject: Re: [Qemu-devel] [RFC V4 12/30] qcow2: Load and save deduplication table header extension. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QmVub8OudCBDYW5ldA==?= Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigB4840CACCD6E4C0157F2F427 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/02/2013 09:16 AM, Beno=C3=AEt Canet wrote: > Signed-off-by: Benoit Canet > --- > block/qcow2.c | 38 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) >=20 > diff --git a/block/qcow2.c b/block/qcow2.c > index 410d3c1..9a7177b 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -53,9 +53,16 @@ typedef struct { > uint32_t len; > } QCowExtension; > =20 > +typedef struct { > + uint64_t offset; > + int32_t size; > + uint8_t hash_algo; > +} QCowDedupTableExtension; This struct has a hole at the end (that is, you only specify 13 bytes, but sizeof(QCowDedupTableExtension) is 16)... > + if (s->has_dedup) { > + dedup_table_extension.offset =3D cpu_to_be64(s->dedup_table_of= fset); > + dedup_table_extension.size =3D cpu_to_be32(s->dedup_table_size= ); > + dedup_table_extension.hash_algo =3D s->dedup_hash_algo; > + ret =3D header_ext_add(buf, > + QCOW2_EXT_MAGIC_DEDUP_TABLE, > + &dedup_table_extension, > + sizeof(dedup_table_extension), > + buflen); =2E..but here you are writing out that hole. It would be better if you explicitly accounted for all bytes being written, so that the reserved fields are guaranteed to be 0 instead of random data, so that future extensions can make use of those reserved bytes. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigB4840CACCD6E4C0157F2F427 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.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with undefined - http://www.enigmail.net/ iQEcBAEBCAAGBQJQ522FAAoJEKeha0olJ0Nq7ZMIAJucIsV75aL0nXe1wCHrFrPU Nl1Q49jdN7DgN1yiDepe1k6n6SFQZTW5Put3FThJZyxfqzIJBPW0+uhdR3V2UCQd p5rq9sbTDKqgrnrxHN5O8+3l1mG03lMKFASFDwk3FGYlhg3NmvntbeA4bv8Jj0fN KPEKUytxWFrFY6H4CfqpQodJpPFvi3FAc0TSvHnr8va45ze+kPSaySqGFK3VHOMp zxZDuXW8ywFhYHJyPQ6tL1P/xucZar4ihDzVhhAkkU/XHkC7LMdCWPsh1TFYBrtc VuHgllcR3IY7b84EWyKLUvMUO5pcw3xeVcQOmCyaTZ3FG5ghzrYhGB4H79kA29I= =4hAY -----END PGP SIGNATURE----- --------------enigB4840CACCD6E4C0157F2F427--