diff options
| author | Rosen Penev <rosenp@gmail.com> | 2026-11-17 20:04:17 -0800 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-11-17 20:21:54 -0800 |
| commit | 7494b0c50c9fcd9f9f5235777bb506dd45676557 (patch) | |
| tree | b0b514a667d7290340fe0e788c3816d7d891365a /rust/kernel/alloc/allocator | |
| parent | 39cd14ca605d1aa55a0ad26767014a88b5c39f20 (diff) | |
hwmon: (dell-smm) Reject out-of-range pwm values
dell_smm_write() scales the value written to pwmN with
DIV_ROUND_CLOSEST(val, data->i8k_pwm_mult)
before clamping the result to the valid fan states. The rounding adds
i8k_pwm_mult / 2 to val first, which overflows for values near
LONG_MAX and wraps to a large negative number. That is then clamped to
0, so writing a huge value turns the fan off instead of running it at
the highest speed. With the default fan_max of 2, writing any value
from LONG_MAX - 63 up to LONG_MAX selects fan state 0.
The pwm range is well defined, so return -EINVAL for values outside
0 to 255, as is the convention for pwm attributes.
Fixes: e7f5f275c62a ("i8k: Implement hwmon based fan speed control")
Cc: stable@vger.kernel.org
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20261118040417.19049-1-rosenp@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions
