From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK7pj-0003x1-B3 for qemu-devel@nongnu.org; Thu, 12 Sep 2013 10:25:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VK7pd-0003Oe-7P for qemu-devel@nongnu.org; Thu, 12 Sep 2013 10:25:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK7pc-0003OX-VU for qemu-devel@nongnu.org; Thu, 12 Sep 2013 10:25:17 -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 r8CEPGrR010057 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 12 Sep 2013 10:25:16 -0400 Message-ID: <5231CECB.7060907@redhat.com> Date: Thu, 12 Sep 2013 08:25:15 -0600 From: Eric Blake MIME-Version: 1.0 References: <1378990647-14079-1-git-send-email-mreitz@redhat.com> In-Reply-To: <1378990647-14079-1-git-send-email-mreitz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="I2T072JcipDutcCEBBLvAoqfVEiF7wJKd" Subject: Re: [Qemu-devel] [PATCH] block: Assert validity of BdrvActionOps List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --I2T072JcipDutcCEBBLvAoqfVEiF7wJKd Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/12/2013 06:57 AM, Max Reitz wrote: > In qmp_transaction, assert that the BdrvActionOps to be used is actuall= y > valid. >=20 > This assertion failing is very improbable, however, it might happen, if= > a new TransactionActionKind is introduced "out of order" and the > actions[] array is not updated. All of which would be a programmer bug, so assert is correct. >=20 > Signed-off-by: Max Reitz > --- > blockdev.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/blockdev.c b/blockdev.c > index 07dac05..14a0bb1 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -1102,6 +1102,8 @@ void qmp_transaction(TransactionActionList *dev_l= ist, Error **errp) > assert(dev_info->kind < ARRAY_SIZE(actions)); > =20 > ops =3D &actions[dev_info->kind]; > + assert(ops->instance_size > 0); Bikeshedding: assert(ops->instance_size) is slightly less typing (but not enough to warrant a respin). Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --I2T072JcipDutcCEBBLvAoqfVEiF7wJKd 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.14 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSMc7LAAoJEKeha0olJ0Nq840H/RjZNqgfZp6W8wnpBdASzh7m pY0m+wFEl/DVFu1w4xKmJIpYAs8glv+u61l7rD8M/oNTxK7eK0zF1PWWlel3ihaC sPLM0UzBsDfeYhRukt6MV35jVS6WXqPxiy2aVpbQtoUwv41yHmeQj1YMKcmGYKap 95gxkRWIbZcBLi2GtOYcZSs2oG7iBsHFgRLzF6ktTEJiqQrK7unEAqNNbiSFaJaM oSMZyHsQ69X6b43xgjtIQEDIhSijqRF1KSbNvLQZ5Z3WugGV4wztY+NIejOs+hff OtsbYFBn4eTrZRCoujDN9cQ1NQOF87GriQEeFLC18A1GxZwN8ZPMo2gnZedYeoQ= =Rig/ -----END PGP SIGNATURE----- --I2T072JcipDutcCEBBLvAoqfVEiF7wJKd--