]> git.proxmox.com Git - mirror_qemu.git/commit - qemu-io-cmds.c
qemu-io: Use correct range limitations
authorMax Reitz <mreitz@redhat.com>
Mon, 20 Jun 2016 14:26:22 +0000 (16:26 +0200)
committerMax Reitz <mreitz@redhat.com>
Wed, 13 Jul 2016 11:41:38 +0000 (13:41 +0200)
commita367467995d0528fe591d87ca2e437c7b7d7951b
tree62d189bc598769a9624e86f25ab7de0cc473f753
parent84c26520d3c1c9ff4a10455748139463278816d5
qemu-io: Use correct range limitations

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 <mreitz@redhat.com>
qemu-io-cmds.c