From: YukiKita Date: Fri, 29 Jul 2016 00:25:17 +0000 (+0900) Subject: Fix overflow caused by signed long division by unsigned long. X-Git-Tag: fio-2.14~75 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=be6bb2b72608d7efbec13d06c67446e229136afa;ds=sidebyside Fix overflow caused by signed long division by unsigned long. The over flow seems to occurr when the value of 'log_avg_msec' option is relatively large. --- diff --git a/gettime.c b/gettime.c index b896b5bd..964a52fa 100644 --- a/gettime.c +++ b/gettime.c @@ -424,8 +424,8 @@ uint64_t mtime_since(const struct timeval *s, const struct timeval *e) if (sec < 0 || (sec == 0 && usec < 0)) return 0; - sec *= 1000UL; - usec /= 1000UL; + sec *= 1000; + usec /= 1000; ret = sec + usec; return ret;