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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Oct 2020 11:12:36 +0000 (13:12 +0200)
commit62658ebe5c19c47419a82b21736770b1d99135e7
treebdecc2f5b147fbc5aa4e0d87046c56d3244804ad
parentdf7c23331f8547f69a752407ddad94a6bbbc52d8
timekeeping: Prevent 32bit truncation in scale64_check_overflow()

[ Upstream commit 4cbbc3a0eeed675449b1a4d080008927121f3da3 ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/time/timekeeping.c