diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2026-06-10 07:46:16 -0700 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-07-27 11:34:24 -0700 |
| commit | e6c80061ca239f45c0eaf7e47a91d6d6df9bd636 (patch) | |
| tree | 58a43e3f71cb6da3c46a00aaed4658a91731fb6a /tools/perf/scripts/python/netdev-times.py | |
| parent | a64a7e8a0b012ba81b0eadbd7afc84ab0dbfd70c (diff) | |
hwmon: (ina2xx) Fix various overflow issues
Sashiko reports several integer overflow problems in the ina2xx driver
caused by unbounded multiplications and inadequate types for intermediate
calculations.
Specifically:
- In ina2xx_get_value(), the return type is changed from int to long.
Intermediate calculations for current are now performed using 64-bit
types to prevent 32-bit integer overflow before the division by 1000.
- When calculating power in ina2xx_get_value() and
sy24655_average_power_read(), interim values are cast to u64 and clamped
to LONG_MAX. This prevents overflow when regval or accumulator_24 is
multiplied by power_lsb_uW.
- In ina226_alert_to_reg(), the clamping logic is rewritten using min_t().
This safely avoids integer overflows when scaling user-provided values
for shunt voltage, bus voltage, power, and current limits.
Cc: Loic Poulain <loic.poulain@oss.qualcomm.com>
Fixes: ab7fbee452be ("hwmon: (ina2xx) Fix various overflow issues")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'tools/perf/scripts/python/netdev-times.py')
0 files changed, 0 insertions, 0 deletions
