diff options
author | Sami Kerola | 2016-07-17 23:04:32 +0200 |
---|---|---|
committer | Sami Kerola | 2017-02-05 00:39:38 +0100 |
commit | 85932da89ee633a8666c6f0191edd760bfac2501 (patch) | |
tree | 82bde78725ea44f13d70d403d19979b9b76459e1 /sys-utils/hwclock.c | |
parent | hwclock: add debugging to open_rtc() (diff) | |
download | kernel-qcow2-util-linux-85932da89ee633a8666c6f0191edd760bfac2501.tar.gz kernel-qcow2-util-linux-85932da89ee633a8666c6f0191edd760bfac2501.tar.xz kernel-qcow2-util-linux-85932da89ee633a8666c6f0191edd760bfac2501.zip |
hwclock: remove division by zero [asan]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/hwclock.c')
-rw-r--r-- | sys-utils/hwclock.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index 99ae29ed1..98933316f 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", |