From: Kevin O'Connor Date: Tue, 27 Jul 2010 02:33:54 +0000 (-0400) Subject: Fix integer truncating bug in calc_future_timer(). X-Git-Tag: rel-0.6.1~28 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=abf31d367a8e80a13cb6d2a8a6c499914c2e91e7;p=seabios.git Fix integer truncating bug in calc_future_timer(). Be sure to promote to u64 before multiplication. --- diff --git a/src/clock.c b/src/clock.c index 49ab901..6d46501 100644 --- a/src/clock.c +++ b/src/clock.c @@ -1,6 +1,6 @@ // 16bit code to handle system clocks. // -// Copyright (C) 2008 Kevin O'Connor +// Copyright (C) 2008-2010 Kevin O'Connor // Copyright (C) 2002 MandrakeSoft S.A. // // This file may be distributed under the terms of the GNU LGPLv3 license. @@ -238,7 +238,7 @@ calc_future_timer(u32 msecs) { if (!msecs) return GET_BDA(timer_counter); - u32 kticks = DIV_ROUND_UP((u64)(msecs * PIT_TICK_RATE), PIT_TICK_INTERVAL); + u32 kticks = DIV_ROUND_UP((u64)msecs * PIT_TICK_RATE, PIT_TICK_INTERVAL); u32 ticks = DIV_ROUND_UP(kticks, 1000); return calc_future_timer_ticks(ticks); }