From: Andreas Henriksson Date: Fri, 12 Oct 2007 08:56:46 +0000 (+0200) Subject: Fix overflow in time2tick / tick2time. X-Git-Tag: v2.6.23-071016~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=447598449817fcaea26016d9102d703c4d16bd9c;p=thirdparty%2Fiproute2.git Fix overflow in time2tick / tick2time. The helper functions gets passed an unsigned int, which gets cast to long and overflows. See http://bugs.debian.org/175462 Signed-off-by: Andreas Henriksson Signed-off-by: Stephen Hemminger --- diff --git a/tc/tc_core.c b/tc/tc_core.c index 58155fbf7..fb8987669 100644 --- a/tc/tc_core.c +++ b/tc/tc_core.c @@ -35,12 +35,12 @@ int tc_core_time2big(long time) } -long tc_core_time2tick(long time) +unsigned tc_core_time2tick(unsigned time) { return time*tick_in_usec; } -long tc_core_tick2time(long tick) +unsigned tc_core_tick2time(unsigned tick) { return tick/tick_in_usec; } diff --git a/tc/tc_core.h b/tc/tc_core.h index a139da6f6..b2a16bc32 100644 --- a/tc/tc_core.h +++ b/tc/tc_core.h @@ -7,8 +7,8 @@ #define TIME_UNITS_PER_SEC 1000000 int tc_core_time2big(long time); -long tc_core_time2tick(long time); -long tc_core_tick2time(long tick); +unsigned tc_core_time2tick(unsigned time); +unsigned tc_core_tick2time(unsigned tick); long tc_core_time2ktime(long time); long tc_core_ktime2time(long ktime); unsigned tc_calc_xmittime(unsigned rate, unsigned size);