From: Max Reitz Date: Thu, 12 Sep 2013 12:57:27 +0000 (+0200) Subject: block: Assert validity of BdrvActionOps X-Git-Tag: v1.7.0-rc0~113^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=aa3fe714f70654da47d9c2659b2d9ee295a9d930;p=thirdparty%2Fqemu.git 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 Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- diff --git a/blockdev.c b/blockdev.c index 2ab236a82de..80605a2bac3 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;