From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a72qB-00067y-LY for qemu-devel@nongnu.org; Thu, 10 Dec 2015 10:09:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a72qA-0000B2-JB for qemu-devel@nongnu.org; Thu, 10 Dec 2015 10:09:07 -0500 References: <1449741348-7198-1-git-send-email-den@openvz.org> From: Eric Blake Message-ID: <56699586.8010203@redhat.com> Date: Thu, 10 Dec 2015 08:08:54 -0700 MIME-Version: 1.0 In-Reply-To: <1449741348-7198-1-git-send-email-den@openvz.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="84NvoHXRK4uMf6Dlv6pX0CjMUQelI4Nmc" Subject: Re: [Qemu-devel] [PATCH 1/1] qcow2: insert assert into qcow2_get_specific_info() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: Kevin Wolf , Roman Kagan , qemu-devel@nongnu.org, qemu block , Max Reitz This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --84NvoHXRK4uMf6Dlv6pX0CjMUQelI4Nmc Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [adding qemu-block in cc, per MAINTAINERS] On 12/10/2015 02:55 AM, Denis V. Lunev wrote: > s->qcow_version is always set to 2 or 3. Let's assert if this is wrong.= >=20 > Signed-off-by: Denis V. Lunev > CC: Roman Kagan > CC: Max Reitz > CC: Kevin Wolf > --- > block/qcow2.c | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > diff --git a/block/qcow2.c b/block/qcow2.c > index 88f56c8..b285014 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -2757,6 +2757,10 @@ static ImageInfoSpecific *qcow2_get_specific_inf= o(BlockDriverState *bs) > .has_corrupt =3D true, > .refcount_bits =3D s->refcount_bits, > }; > + } else { > + /* if this assertion fails, this probably means a new version = was > + * added without having it covered here */ > + assert(false); Only covers us if we don't turn on NDEBUG during compile; but then again, lots of spots in the code base assume assert() will never be crippled. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --84NvoHXRK4uMf6Dlv6pX0CjMUQelI4Nmc 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/ iQEcBAEBCAAGBQJWaZWGAAoJEKeha0olJ0NqQjIH/1YF4y8FFQNI/EkKXKCbm/z5 0f6+UvsdWoHOy9VpL1K643ymiCe5+wu+9WNICvEm2vYLJpnmR2uRsA6EAFizD6fK IRbh0d5fosOKhcGAzUmJ2dIWaSGE7uYav1fOvERWTV3w1JYd1d8vsmr87kytM3H+ 9bfcoMi2eoDjNruF5YwMYTMw3eeLj8mqU1AKuQAH+bZIqCgkYgSQb3zWBHbNpdcX 9bOmvCKAoGNHS0RIdlCMExDLFFkclhfv1qXzS8uVgPLpm+26bE9G/pwWX79yf/3E ySm3JKU62B8dIwYE4VcC4QRLcUNTpgjQZ74XCW5YAFpzINFnyf5rXpAXqxvaWX0= =EuHE -----END PGP SIGNATURE----- --84NvoHXRK4uMf6Dlv6pX0CjMUQelI4Nmc--