[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 32/33] block: Assert validity of BdrvActionOps

From: Kevin Wolf
Subject: [Qemu-devel] [PULL 32/33] block: Assert validity of BdrvActionOps
Date: Fri, 13 Sep 2013 13:51:02 +0200

From: Max Reitz <address@hidden>

In qmp_transaction, assert that the BdrvActionOps to be used is actually

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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
 blockdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/blockdev.c b/blockdev.c
index 2ab236a..80605a2 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;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]