[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250423150233.38fb5437@device-40.home>
Date: Wed, 23 Apr 2025 15:02:33 +0200
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: Alexis Lothoré <alexis.lothore@...tlin.com>
Cc: Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Maxime Coquelin
<mcoquelin.stm32@...il.com>, Alexandre Torgue
<alexandre.torgue@...s.st.com>, Richard Cochran <richardcochran@...il.com>,
Daniel Machon <daniel.machon@...rochip.com>, Thomas Petazzoni
<thomas.petazzoni@...tlin.com>, netdev@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
"Russell King (Oracle)" <linux@...linux.org.uk>
Subject: Re: [PATCH net v2 2/2] net: stmmac: fix multiplication overflow
when reading timestamp
On Wed, 23 Apr 2025 09:12:10 +0200
Alexis Lothoré <alexis.lothore@...tlin.com> wrote:
> The current way of reading a timestamp snapshot in stmmac can lead to
> integer overflow, as the computation is done on 32 bits. The issue has
> been observed on a dwmac-socfpga platform returning chaotic timestamp
> values due to this overflow. The corresponding multiplication is done
> with a MUL instruction, which returns 32 bit values. Explicitly casting
> the value to 64 bits replaced the MUL with a UMLAL, which computes and
> returns the result on 64 bits, and so returns correctly the timestamps.
>
> Prevent this overflow by explicitly casting the intermediate value to
> u64 to make sure that the whole computation is made on u64. While at it,
> apply the same cast on the other dwmac variant (GMAC4) method for
> snapshot retrieval.
>
> Fixes: 477c3e1f6363 ("net: stmmac: Introduce dwmac1000 timestamping operations")
> Signed-off-by: Alexis Lothoré <alexis.lothore@...tlin.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@...tlin.com>
Thanks,
Maxime
Powered by blists - more mailing lists