From: Stefano Garzarella Date: Tue, 5 Oct 2021 16:11:57 +0000 (+0200) Subject: block/aio_task: assert `max_busy_tasks` is greater than 0 X-Git-Tag: v6.2.0-rc0~65^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a9515df4d66da34cbc2938e4c1f46015fc74ff93;p=thirdparty%2Fqemu.git block/aio_task: assert `max_busy_tasks` is greater than 0 All code in block/aio_task.c expects `max_busy_tasks` to always be greater than 0. Assert this condition during the AioTaskPool creation where `max_busy_tasks` is set. Signed-off-by: Stefano Garzarella Reviewed-by: Vladimir Sementsov-Ogievskiy Message-Id: <20211005161157.282396-3-sgarzare@redhat.com> Signed-off-by: Vladimir Sementsov-Ogievskiy --- diff --git a/block/aio_task.c b/block/aio_task.c index 88989fa248c..9bd17ea2c13 100644 --- a/block/aio_task.c +++ b/block/aio_task.c @@ -98,6 +98,8 @@ AioTaskPool *coroutine_fn aio_task_pool_new(int max_busy_tasks) { AioTaskPool *pool = g_new0(AioTaskPool, 1); + assert(max_busy_tasks > 0); + pool->main_co = qemu_coroutine_self(); pool->max_busy_tasks = max_busy_tasks;