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)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Mar 2021 19:10:03 +0000 (12:10 -0700)
commitf51d7bf1dbe5522c51c93fe8faa5f4abbdf339cd
tree9bf2cbf2895eef9c81e4ec338c0dd9fa37b08812
parent6ab4c3117aec4e08007d9e971fa4133e1de1082d
ptp_qoriq: fix overflow in ptp_qoriq_adjfine() u64 calcalation

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>
drivers/ptp/ptp_qoriq.c