On 06/20/2016 08:26 AM, Max Reitz wrote:
> create_iovec() has a comment lamenting the lack of SIZE_T_MAX. Since
> there actually is a SIZE_MAX, use it.
> 
> Two places use INT_MAX for checking the upper bound of a sector count
> that is used as an argument for a blk_*() function (blk_discard() and
> blk_write_compressed(), respectively). BDRV_REQUEST_MAX_SECTORS should
> be used instead.
> 
> And finally, do_co_pwrite_zeroes() used to similarly check that the
> sector count does not exceed INT_MAX. However, this function is now
> backed by blk_co_pwrite_zeroes() which takes bytes as an argument
> instead of sectors. Therefore, it should be the byte count that does not
> exceed INT_MAX, not the sector count.
> 
> Signed-off-by: Max Reitz <mre...@redhat.com>
> ---
>  qemu-io-cmds.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 

> @@ -500,7 +499,7 @@ static int do_write_compressed(BlockBackend *blk, char 
> *buf, int64_t offset,
>  {
>      int ret;
>  
> -    if (count >> 9 > INT_MAX) {
> +    if (count >> 9 > BDRV_REQUEST_MAX_SECTORS) {

Worth s/9/BDRV_SECTOR_BITS/ while touching it?  But not a show-stopper
either way.

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

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to