diff options
| author | Len Brown <len.brown@intel.com> | 2026-05-06 10:00:00 -0400 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2026-10-03 14:49:37 -0400 |
| commit | 242cdafe7a70dddec37f4ce18ef61152020941f2 (patch) | |
| tree | db9c9f3914b9d8c2c89cc14ac9e23a3195a92eae /tools/perf/scripts/python/flamegraph.py | |
| parent | 37cefc131a262277da158d8ab19575a1b1643ebb (diff) | |
| download | linux-next-242cdafe7a70dddec37f4ce18ef61152020941f2.tar.gz linux-next-242cdafe7a70dddec37f4ce18ef61152020941f2.zip | |
x86_energy_perf_policy: Fix ratio overflow
Prevent integer overflow in ratio_2_msr_perf() by using 64-bit
arithmetic for the intermediate multiplication calculation.
The original code multiplies ratio * 255 in 32-bit integer
arithmetic before dividing by bdx_highest_ratio. With ratio near
INT_MAX, this multiplication can overflow before the division,
producing incorrect performance scaling values.
Using (unsigned long long) for the intermediate calculation ensures
the multiplication completes without overflow, then the result is
safely divided and cast back to int.
Fixes: 4beec1d75196 ("tools/power x86_energy_perf_policy: support HWP.EPP")
Assisted-by: GitHub-Copilot:Claude-Sonnet-4.6
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools/perf/scripts/python/flamegraph.py')
0 files changed, 0 insertions, 0 deletions
