qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 10/12] block-backend: convert blk_aio_ functions to int64_t b


From: Eric Blake
Subject: Re: [PATCH 10/12] block-backend: convert blk_aio_ functions to int64_t bytes paramter
Date: Wed, 6 Oct 2021 15:29:25 -0500
User-agent: NeoMutt/20210205-815-1dd940

On Wed, Oct 06, 2021 at 03:17:16PM +0200, Vladimir Sementsov-Ogievskiy wrote:
> 1. Convert bytes in BlkAioEmAIOCB:
>   aio->bytes is only passed to already int64_t interfaces, and set in
>   blk_aio_prwv, which is updated here.
> 
> 2. For all updated functions parameter type becomes wider so callers
>    are safe.
> 
> 3. In blk_aio_prwv we only store bytes to BlkAioEmAIOCB, which is
>    updated here.
> 
> 4. Other updated functions are wrappers on blk_aio_prwv.
> 
> Note that blk_aio_preadv and blk_aio_pwritev become safer: before this
> commit, it's theoretically possible to pass qiov with size exceeding
> INT_MAX, which than converted to int argument of blk_aio_prwv. Now it's
> converted to int64_t which is a lot better. Still add assertions.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  include/sysemu/block-backend.h |  4 ++--
>  block/block-backend.c          | 13 ++++++++-----
>  2 files changed, 10 insertions(+), 7 deletions(-)
> 
> @@ -1530,6 +1531,7 @@ BlockAIOCB *blk_aio_preadv(BlockBackend *blk, int64_t 
> offset,
>                             QEMUIOVector *qiov, BdrvRequestFlags flags,
>                             BlockCompletionFunc *cb, void *opaque)
>  {
> +    assert(qiov->size <= INT64_MAX);

I hope this doesn't cause 32-bit compilers to warn about an
always-true expression; but if it does, we'll figure something out.
That's not enough for me to ask for you to respin this, though, so:

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org




reply via email to

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