qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-io: Use correct range limitations
Date: Mon, 20 Jun 2016 09:23:58 -0600	[thread overview]
Message-ID: <57680A8E.4090009@redhat.com> (raw)
In-Reply-To: <20160620142623.24471-2-mreitz@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1348 bytes --]

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 <mreitz@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 <eblake@redhat.com>

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-06-20 15:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20 14:26 [Qemu-devel] [PATCH 0/2] qcow2: Fix qcow2_get_cluster_offset() Max Reitz
2016-06-20 14:26 ` [Qemu-devel] [PATCH 1/2] qemu-io: Use correct range limitations Max Reitz
2016-06-20 15:23   ` Eric Blake [this message]
2016-06-20 14:26 ` [Qemu-devel] [PATCH 2/2] qcow2: Fix qcow2_get_cluster_offset() Max Reitz
2016-06-20 15:31   ` [Qemu-devel] [Qemu-block] " Eric Blake
2016-07-05 17:44 ` [Qemu-devel] [PATCH 0/2] " Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57680A8E.4090009@redhat.com \
    --to=eblake@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).