Commit eccffcf4 authored by Xiaoliang Yang's avatar Xiaoliang Yang Committed by Jakub Kicinski

net: stmmac: ptp: fix potentially overflowing expression

Convert the u32 variable to type u64 in a context where expression of
type u64 is required to avoid potential overflow.

Fixes: e9e37200 ("net: stmmac: ptp: update tas basetime after ptp adjust")
Signed-off-by: default avatarXiaoliang Yang <xiaoliang.yang_1@nxp.com>
Link: https://lore.kernel.org/r/20211223073928.37371-1-xiaoliang.yang_1@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent ae2778a6
......@@ -102,7 +102,7 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta)
time.tv_nsec = priv->plat->est->btr_reserve[0];
time.tv_sec = priv->plat->est->btr_reserve[1];
basetime = timespec64_to_ktime(time);
cycle_time = priv->plat->est->ctr[1] * NSEC_PER_SEC +
cycle_time = (u64)priv->plat->est->ctr[1] * NSEC_PER_SEC +
priv->plat->est->ctr[0];
time = stmmac_calc_tas_basetime(basetime,
current_time_ns,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment