[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
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 <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;
--
1.8.1.4
- [Qemu-devel] [PULL 22/33] bdrv: Use "Error" for opening images, (continued)
- [Qemu-devel] [PULL 22/33] bdrv: Use "Error" for opening images, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 23/33] bdrv: Use "Error" for creating images, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 26/33] qemu-img create: Emit filename on error, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 24/33] block: Error parameter for open functions, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 25/33] block: Error parameter for create functions, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 29/33] coroutine: add ./configure --disable-coroutine-pool, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 28/33] qemu-iotests: Adjustments due to error propagation, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 27/33] qcow2: Use Error parameter, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 30/33] qemu-img: fix invalid JSON, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 31/33] qemu-iotests: Cleanup test image in test number 007, Kevin Wolf, 2013/09/13
- [Qemu-devel] [PULL 32/33] block: Assert validity of BdrvActionOps,
Kevin Wolf <=
- [Qemu-devel] [PULL 33/33] qemu-iotests: Fix test 038, Kevin Wolf, 2013/09/13