* [PATCH net] net: stmmac: ptp: fix potentially overflowing expression
@ 2021-12-23 7:39 Xiaoliang Yang
2021-12-23 18:00 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Xiaoliang Yang @ 2021-12-23 7:39 UTC (permalink / raw)
To: davem, netdev, linux-kernel
Cc: kuba, peppe.cavallaro, alexandre.torgue, joabreu, Jose.Abreu,
mst, Joao.Pinto, xiaoliang.yang_1
Convert the u32 variable to type u64 in a context where expression of
type u64 is required to avoid potential overflow.
Fixes: e9e3720002f6 ("net: stmmac: ptp: update tas basetime after ptp adjust")
Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index 580cc035536b..be9b58b2abf9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -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,
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net: stmmac: ptp: fix potentially overflowing expression
2021-12-23 7:39 [PATCH net] net: stmmac: ptp: fix potentially overflowing expression Xiaoliang Yang
@ 2021-12-23 18:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-12-23 18:00 UTC (permalink / raw)
To: Xiaoliang Yang
Cc: davem, netdev, linux-kernel, kuba, peppe.cavallaro,
alexandre.torgue, joabreu, Jose.Abreu, mst, Joao.Pinto
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 23 Dec 2021 15:39:28 +0800 you wrote:
> Convert the u32 variable to type u64 in a context where expression of
> type u64 is required to avoid potential overflow.
>
> Fixes: e9e3720002f6 ("net: stmmac: ptp: update tas basetime after ptp adjust")
> Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- [net] net: stmmac: ptp: fix potentially overflowing expression
https://git.kernel.org/netdev/net/c/eccffcf4657a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-23 18:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-23 7:39 [PATCH net] net: stmmac: ptp: fix potentially overflowing expression Xiaoliang Yang
2021-12-23 18:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).