qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] block: Assert validity of BdrvActionOps
Date: Thu, 12 Sep 2013 08:25:15 -0600	[thread overview]
Message-ID: <5231CECB.7060907@redhat.com> (raw)
In-Reply-To: <1378990647-14079-1-git-send-email-mreitz@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]

On 09/12/2013 06:57 AM, Max Reitz wrote:
> In qmp_transaction, assert that the BdrvActionOps to be used is actually
> valid.
> 
> 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.

> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  blockdev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> 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_list, Error **errp)
>          assert(dev_info->kind < ARRAY_SIZE(actions));
>  
>          ops = &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 <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

  reply	other threads:[~2013-09-12 14:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12 12:57 [Qemu-devel] [PATCH] block: Assert validity of BdrvActionOps Max Reitz
2013-09-12 14:25 ` Eric Blake [this message]
2013-09-12 14:28 ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5231CECB.7060907@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).