qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Fix integer overflow in block migration bandwid


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH] Fix integer overflow in block migration bandwidth calculation
Date: Tue, 05 Apr 2011 14:54:58 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10

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 <address@hidden>

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 via email to

[Prev in Thread] Current Thread [Next in Thread]