Re: [PATCH net] net: dlink: mask rx_coalesce/rx_timeout before writing RxDMAIntCtrl
From: Andrew Lunn
Date: Tue Dec 23 2025 - 04:43:37 EST
On Tue, Dec 23, 2025 at 09:10:06AM +0900, Yeounsu Moon wrote:
> RxDMAIntCtrl encodes rx_coalesce in the low 16 bits
> and rx_timeout in the high 16 bits. If either value exceeds
> the field width, the current code may truncate the value and/or
> corrupt adjacent bits when programming the register.
>
> Mask both values to 16 bits and cast to u32 before shifting
> so only the intended fields are written.
It would be better to do range checks in rio_probe1() and call
netdev_err() and return -EINVAL?
Anybody trying to use very large values then gets an error message
rather than it working, but not as expected.
Andrew