]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit8fba7987bc254a8968cf42f22e2d16a629a8f84a
tree9bf2cbf2895eef9c81e4ec338c0dd9fa37b08812
parentf862e451c4499ffb26c2fee95994786bb0589ae2
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