Re: [PATCH net] net: sundance: fix sign extension of the octet counters

From: Rand Deeb

Date: Tue Oct 20 2026 - 22:25:41 EST


On Wed, Oct 21, 2026 at 4:11 AM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>
> We don't take LLM slop fixes for ancient hw

The change itself is a simple cast, so I was surprised by the "LLM
slop" remark. The same kind of fix was applied in 2776d2320ac1
(net: dsa: fix unintended sign extension on a u16 left shift), which
you committed in 2020. If it was the commit message that gave that
impression, I can make it shorter next time.

The issue was reported by SVACE static analysis, on architectures where
ioread16() returns u16, the high word is promoted to int and sign
extended when it is added to the unsigned long counter, so
tx_bytes, rx_bytes end up wrong on 64-bit.

The issue is theoretical and the change was not tested on real
hardware, as I don't have the hardware.
If you don't want changes to this driver without hardware
testing, that's your call. The issue is real and the fix is correct,
it is not security related, but it is still a bug on those
architectures.

Regards,
Rand