From: Sami Kerola Date: Sun, 17 Jul 2016 21:04:32 +0000 (+0100) Subject: hwclock: remove division by zero [asan] X-Git-Tag: v2.30-rc1~267^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85932da89ee633a8666c6f0191edd760bfac2501;p=thirdparty%2Futil-linux.git hwclock: remove division by zero [asan] Signed-off-by: Sami Kerola --- diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index 99ae29ed1d..98933316f0 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -1399,9 +1399,10 @@ static int compare_clock(const struct hwclock_control *ctl) mktime_tz(ctl, tm, &hclock_valid, &time2_hw); - res = (((double) time1_hw - time1_sys) - - ((double) time2_hw - time2_sys)) - / (double) (time2_hw - time1_hw); + if ((res = time2_hw - time1_hw)) + res = (((double)time1_hw - time1_sys) - + ((double)time2_hw - time2_sys)) + / res; if (!first_pass) printf("%10.0f %10.6f %15.0f %4.0f\n",