ptp_qoriq: fix overflow in ptp_qoriq_adjfine() u64 calcalation
authorYangbo Lu <yangbo.lu@nxp.com>
Tue, 23 Mar 2021 08:02:29 +0000 (16:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Apr 2021 11:36:09 +0000 (13:36 +0200)
commit266d3106efbd9ffe92e0b86789299feae0750991
treef8f888d784962a0cc6b21216b45c90fbd1ccecd1
parentf135b89e286b5cf6d432860981b71b77b7049594
ptp_qoriq: fix overflow in ptp_qoriq_adjfine() u64 calcalation

[ Upstream commit f51d7bf1dbe5522c51c93fe8faa5f4abbdf339cd ]

Current calculation for diff of TMR_ADD register value may have
64-bit overflow in this code line, when long type scaled_ppm is
large.

adj *= scaled_ppm;

This patch is to resolve it by using mul_u64_u64_div_u64().

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/ptp/ptp_qoriq.c