From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=51397 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7UmM-0001uZ-RC for qemu-devel@nongnu.org; Wed, 06 Apr 2011 11:36:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q7UmL-0000RN-Hh for qemu-devel@nongnu.org; Wed, 06 Apr 2011 11:36:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15288) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q7UmL-0000RH-1R for qemu-devel@nongnu.org; Wed, 06 Apr 2011 11:36:21 -0400 Message-ID: <4D9C88FE.1000108@redhat.com> Date: Wed, 06 Apr 2011 17:38:38 +0200 From: Kevin Wolf MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v2] Fix integer overflow in block migration bandwidth calculation List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avishay Traeger Cc: qemu-devel@nongnu.org, Liran Schour Am 06.04.2011 09:45, 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). Change order to avoid. > > Signed-off-by: Avishay Traeger Thanks, applied to the block branch. > --- > block-migration.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/block-migration.c b/block-migration.c > index 8218bac..576e55a 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 (block_mig_state.reads / block_mig_state.total_time) * > BLOCK_SIZE; Your lines are still wrapped. I had to fix this up manually. Kevin