qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] block: Fix 32 bit truncation in mark_request_serialising()
Date: Sat, 08 Feb 2014 10:53:28 +0100	[thread overview]
Message-ID: <52F5FE98.1030505@redhat.com> (raw)
In-Reply-To: <1391852864-11969-1-git-send-email-kwolf@redhat.com>

On 02/08/14 10:47, Kevin Wolf wrote:
> On 32 bit hosts, size_t is too small for align as the bitmask
> ~(align - 1) will zero out the higher 32 bits of the offset.
> 
> While at it, change the local overlap_bytes variable to unsigned to
> match the field in BdrvTrackedRequest.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/block.c b/block.c
> index b0c5025..636aa11 100644
> --- a/block.c
> +++ b/block.c
> @@ -2240,11 +2240,11 @@ static void tracked_request_begin(BdrvTrackedRequest *req,
>      QLIST_INSERT_HEAD(&bs->tracked_requests, req, list);
>  }
>  
> -static void mark_request_serialising(BdrvTrackedRequest *req, size_t align)
> +static void mark_request_serialising(BdrvTrackedRequest *req, uint64_t align)
>  {
>      int64_t overlap_offset = req->offset & ~(align - 1);
> -    int overlap_bytes = ROUND_UP(req->offset + req->bytes, align)
> -                      - overlap_offset;
> +    unsigned int overlap_bytes = ROUND_UP(req->offset + req->bytes, align)
> +                               - overlap_offset;
>  
>      if (!req->serialising) {
>          req->bs->serialising_in_flight++;
> 

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thanks!
Laszlo

      reply	other threads:[~2014-02-08  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-08  9:47 [Qemu-devel] [PATCH] block: Fix 32 bit truncation in mark_request_serialising() Kevin Wolf
2014-02-08  9:53 ` Laszlo Ersek [this message]

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=52F5FE98.1030505@redhat.com \
    --to=lersek@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).