aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
authorAlexis LothorĂ© <[email protected]>2025-04-23 07:12:10 +0000
committerPaolo Abeni <[email protected]>2025-04-24 09:50:20 +0000
commit7b7491372f8ec2d8c08da18e5d629e55f41dda89 (patch)
tree310a8c48347ddec0e77a3a00b59420730a532c74 /net/unix/af_unix.c
parentnet: stmmac: fix dwmac1000 ptp timestamp status offset (diff)
downloadkernel-7b7491372f8ec2d8c08da18e5d629e55f41dda89.tar.gz
kernel-7b7491372f8ec2d8c08da18e5d629e55f41dda89.zip
net: stmmac: fix multiplication overflow when reading timestamp
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Ă© <[email protected]> Reviewed-by: Maxime Chevallier <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'net/unix/af_unix.c')
0 files changed, 0 insertions, 0 deletions