diff options
author | Max Reitz <mreitz@redhat.com> | 2013-09-12 14:57:27 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2013-09-12 16:28:36 +0200 |
commit | aa3fe714f70654da47d9c2659b2d9ee295a9d930 (patch) | |
tree | 1c76f75d3884b81c965fcb01e02d8781370f9551 | |
parent | 4aa846f25e7cf14c77f699d8c1dfdfeddb091161 (diff) |
block: Assert validity of BdrvActionOps
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.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r-- | blockdev.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c index 2ab236a82d..80605a2bac 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1286,6 +1286,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); + state = g_malloc0(ops->instance_size); state->ops = ops; state->action = dev_info; |