]> git.baikalelectronics.ru Git - kernel.git/commit
timekeeping: Prevent 32bit truncation in scale64_check_overflow()
authorWen Yang <wenyang@linux.alibaba.com>
Mon, 20 Jan 2020 10:05:23 +0000 (18:05 +0800)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 4 Mar 2020 09:17:51 +0000 (10:17 +0100)
commit440d01fc95fe2c02e2d60e0d68be3dd35bf7d169
tree739aabe30a12d1aa42c056394faf89fb3b45444c
parent49dff230c581814baee0cc419b3c208973355771
timekeeping: Prevent 32bit truncation in scale64_check_overflow()

While unlikely the divisor in scale64_check_overflow() could be >= 32bit in
scale64_check_overflow(). do_div() truncates the divisor to 32bit at least
on 32bit platforms.

Use div64_u64() instead to avoid the truncation to 32-bit.

[ tglx: Massaged changelog ]

Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200120100523.45656-1-wenyang@linux.alibaba.com
kernel/time/timekeeping.c