From: Stefano Garzarella <sgarzare@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
John Snow <jsnow@redhat.com>,
qemu-block@nongnu.org
Subject: [PATCH 2/2] block/aio_task: assert `max_busy_tasks` is greater than 0
Date: Tue, 5 Oct 2021 18:11:57 +0200 [thread overview]
Message-ID: <20211005161157.282396-3-sgarzare@redhat.com> (raw)
In-Reply-To: <20211005161157.282396-1-sgarzare@redhat.com>
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 <sgarzare@redhat.com>
---
block/aio_task.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/aio_task.c b/block/aio_task.c
index 88989fa248..9bd17ea2c1 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;
--
2.31.1
next prev parent reply other threads:[~2021-10-05 17:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-05 16:11 [PATCH 0/2] block: avoid integer overflow of `max-workers` and assert `max_busy_tasks` Stefano Garzarella
2021-10-05 16:11 ` [PATCH 1/2] block/backup: avoid integer overflow of `max-workers` Stefano Garzarella
2021-10-05 16:25 ` Vladimir Sementsov-Ogievskiy
2021-10-05 16:11 ` Stefano Garzarella [this message]
2021-10-05 16:28 ` [PATCH 2/2] block/aio_task: assert `max_busy_tasks` is greater than 0 Vladimir Sementsov-Ogievskiy
2021-10-05 16:38 ` [PATCH 0/2] block: avoid integer overflow of `max-workers` and assert `max_busy_tasks` Vladimir Sementsov-Ogievskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211005161157.282396-3-sgarzare@redhat.com \
--to=sgarzare@redhat.com \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).