diff options
| author | Aldo Ariel Panzardo <qwe.aldo@gmail.com> | 2026-11-06 22:26:36 -0300 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.com> | 2026-11-20 14:59:24 +0100 |
| commit | 4ea5f646f5f0c30f05e0576268f0bb913b1f05e2 (patch) | |
| tree | ec912b677c7a306f25cb8ce60245a3fa7c14af1e /tools/perf/scripts/python/task-analyzer.py | |
| parent | 896143ce9368435c185e7d5a4f42380aeab01778 (diff) | |
HID: wacom: validate battery range before scaling
Battery events divide by the difference between the logical maximum
and minimum without validating the range. A malformed HID descriptor
with equal limits can therefore trigger a divide-by-zero exception.
Move percentage conversion to a helper that rejects non-positive
ranges and accounts for a nonzero logical minimum. Clamp the result
to [0, 100] as an additional safeguard against out-of-range
percentages.
Fixes: 37d160193834 ("HID: wacom: generic: Scale battery capacity measurements to percentages")
Cc: stable@vger.kernel.org
Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'tools/perf/scripts/python/task-analyzer.py')
0 files changed, 0 insertions, 0 deletions
