Skip to content

Commit eccffcf

Browse files
Xiaoliang Yangkuba-moo
authored andcommitted
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: e9e3720 ("net: stmmac: ptp: update tas basetime after ptp adjust") Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com> Link: https://lore.kernel.org/r/20211223073928.37371-1-xiaoliang.yang_1@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent ae2778a commit eccffcf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta)
102102
time.tv_nsec = priv->plat->est->btr_reserve[0];
103103
time.tv_sec = priv->plat->est->btr_reserve[1];
104104
basetime = timespec64_to_ktime(time);
105-
cycle_time = priv->plat->est->ctr[1] * NSEC_PER_SEC +
105+
cycle_time = (u64)priv->plat->est->ctr[1] * NSEC_PER_SEC +
106106
priv->plat->est->ctr[0];
107107
time = stmmac_calc_tas_basetime(basetime,
108108
current_time_ns,

0 commit comments

Comments
 (0)