Commit 44759844 authored by Andreas Henriksson's avatar Andreas Henriksson Committed by Stephen Hemminger

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/175462Signed-off-by: default avatarAndreas Henriksson <andreas@fatal.se>
Signed-off-by: default avatarStephen Hemminger <shemminger@linux-foundation.org>
parent f7c3cefc
...@@ -35,12 +35,12 @@ int tc_core_time2big(long time) ...@@ -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; return time*tick_in_usec;
} }
long tc_core_tick2time(long tick) unsigned tc_core_tick2time(unsigned tick)
{ {
return tick/tick_in_usec; return tick/tick_in_usec;
} }
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#define TIME_UNITS_PER_SEC 1000000 #define TIME_UNITS_PER_SEC 1000000
int tc_core_time2big(long time); int tc_core_time2big(long time);
long tc_core_time2tick(long time); unsigned tc_core_time2tick(unsigned time);
long tc_core_tick2time(long tick); unsigned tc_core_tick2time(unsigned tick);
long tc_core_time2ktime(long time); long tc_core_time2ktime(long time);
long tc_core_ktime2time(long ktime); long tc_core_ktime2time(long ktime);
unsigned tc_calc_xmittime(unsigned rate, unsigned size); unsigned tc_calc_xmittime(unsigned rate, unsigned size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment