Re: [PATCH] hwmon: (dell-smm) overflow check during multiplication
From: Guenter Roeck
Date: Thu Nov 13 2025 - 15:34:55 EST
On Mon, Nov 10, 2025 at 06:22:41PM +0300, Alexandr Sapozhnikov wrote:
> Added overflow checking when multiplying int by int and writing the result
> to long to prevent data corruption due to overflow.
>
So when / how would this ever overflow ? The nominal speed is guaranteed
to be <= 65,535, and the multiplier is either 1 or 30 or configured by a
module parameter. That means it must be set to an outrageous value on
purpose to trigger the overflow. This is not worth a runtime check.
Add a validation to the probe function instead, and refuse to load the
driver if the user specified an unreasonable value (such as anything
>= 65,536).
Thanks,
Guenter