qemu-stable
[Top][All Lists]
Advanced

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

Re: [Qemu-stable] [PATCH] block: fix big write


From: Paolo Bonzini
Subject: Re: [Qemu-stable] [PATCH] block: fix big write
Date: Fri, 05 Dec 2014 17:33:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0


On 05/12/2014 17:15, Ming Lei wrote:
> From: Ming Lei <address@hidden>
> 
> QEMU block should have supported to read/write at most
> 0x7fffff * 512 bytes, unfortunately INT_MAX is used to check
> bytes in both bdrv_co_do_writev() and bdrv_check_byte_request(),
> so cause write failure if nr_sectors is equal or more
> than 0x400000.
> 
> There are still other INT_MAX usages in block.c, and they might
> need to change to UINT_MAX too in future, but at least
> this patch's change can make SCSI WRITE SAME 16 workable.
> 
> Cc: address@hidden
> Signed-off-by: Ming Lei <address@hidden>

Alternatively, I'd accept a SCSI patch setting max_ws_blocks and friends
to 2GB - 1 block.

Paolo

> ---
>  block.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/block.c b/block.c
> index a612594..ddc18c2 100644
> --- a/block.c
> +++ b/block.c
> @@ -2607,7 +2607,7 @@ static int bdrv_check_byte_request(BlockDriverState 
> *bs, int64_t offset,
>  {
>      int64_t len;
>  
> -    if (size > INT_MAX) {
> +    if (size > UINT_MAX) {
>          return -EIO;
>      }
>  
> @@ -3420,7 +3420,7 @@ static int coroutine_fn 
> bdrv_co_do_writev(BlockDriverState *bs,
>      int64_t sector_num, int nb_sectors, QEMUIOVector *qiov,
>      BdrvRequestFlags flags)
>  {
> -    if (nb_sectors < 0 || nb_sectors > (INT_MAX >> BDRV_SECTOR_BITS)) {
> +    if (nb_sectors < 0 || nb_sectors > (UINT_MAX >> BDRV_SECTOR_BITS)) {
>          return -EINVAL;
>      }
>  
> 



reply via email to

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