[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <bbbb4405-4b13-498a-a7c6-f15fee69903d@roeck-us.net>
Date: Thu, 13 Nov 2025 12:34:53 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Alexandr Sapozhnikov <alsp705@...il.com>
Cc: Pali Rohár <pali@...nel.org>,
Jean Delvare <jdelvare@...e.com>, linux-hwmon@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hwmon: (dell-smm) overflow check during multiplication
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
Powered by blists - more mailing lists