[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] util/async.c: Forbid negative min/max in aio_context_set_thr
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH] util/async.c: Forbid negative min/max in aio_context_set_thread_pool_params() |
Date: |
Thu, 25 Jul 2024 15:57:48 -0400 |
On Tue, Jul 23, 2024 at 04:09:27PM +0100, Peter Maydell wrote:
> aio_context_set_thread_pool_params() takes two int64_t arguments to
> set the minimum and maximum number of threads in the pool. We do
> some bounds checking on these, but we don't catch the case where the
> inputs are negative. This means that later in the function when we
> assign these inputs to the AioContext::thread_pool_min and
> ::thread_pool_max fields, which are of type int, the values might
> overflow the smaller type.
>
> A negative number of threads is meaningless, so make
> aio_context_set_thread_pool_params() return an error if either min or
> max are negative.
>
> Resolves: Coverity CID 1547605
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> util/async.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks, applied to my block tree:
https://gitlab.com/stefanha/qemu/commits/block
Stefan
signature.asc
Description: PGP signature