qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Avishay Traeger <AVISHAY@il.ibm.com>
Cc: qemu-devel@nongnu.org, Liran Schour <LIRANS@il.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] Fix integer overflow in block migration bandwidth calculation
Date: Tue, 05 Apr 2011 14:54:58 +0200	[thread overview]
Message-ID: <4D9B1122.5070804@redhat.com> (raw)
In-Reply-To: <OFBBFDA642.7A3B3819-ONC2257864.004A9649-C2257864.004C30B0@il.ibm.com>

Am 31.03.2011 15:52, schrieb Avishay Traeger:
> 
> block_mig_state.reads is an int, and multiplying by BLOCK_SIZE yielded a
> negative number, resulting in a negative bandwidth (running on a 32-bit
> machine).  Cast to avoid.
> 
> Signed-off-by: Avishay Traeger <avishay@il.ibm.com>

This patch is corrupted by line wraps.

> ---
>  block-migration.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/block-migration.c b/block-migration.c
> index 8218bac..ffc92ee 100644
> --- a/block-migration.c
> +++ b/block-migration.c
> @@ -140,7 +140,7 @@ static inline void add_avg_read_time(int64_t time)
>  static inline long double compute_read_bwidth(void)
>  {
>      assert(block_mig_state.total_time != 0);
> -    return  (block_mig_state.reads * BLOCK_SIZE)/
> block_mig_state.total_time;
> +    return  ((long long)block_mig_state.reads * BLOCK_SIZE)/
> block_mig_state.total_time;

This line exceeds 80 characters. While you're at it, you could add a
space before the /

Kevin

      reply	other threads:[~2011-04-05 12:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-31 13:52 [Qemu-devel] [PATCH] Fix integer overflow in block migration bandwidth calculation Avishay Traeger
2011-04-05 12:54 ` Kevin Wolf [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=4D9B1122.5070804@redhat.com \
    --to=kwolf@redhat.com \
    --cc=AVISHAY@il.ibm.com \
    --cc=LIRANS@il.ibm.com \
    --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).