diff options
| author | Gabe Teeger <gabe.teeger@amd.com> | 2026-03-16 10:41:27 -0400 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2026-03-30 14:40:20 -0400 |
| commit | 1f991ceb2c0bd37214387a645a1d3a260d423f7d (patch) | |
| tree | 7779eb632fe31380c71cf459c62185390f74b0e0 /tools/perf/scripts/python/export-to-postgresql.py | |
| parent | ee212b0208a18831d2b537865da56708c17af90d (diff) | |
drm/amd/display: Fix bounds checking in dml2_0 clock table array
[Why]
Multiple locations in dml2_0 used num_clk_values-1 as array index
without checking if num_clk_values > 0. When num_clk_values is 0,
this results in accessing array index -1, which wraps to 255 for
unsigned types, causing out-of-bounds memory access and potential
crashes.
[How]
Add proper bounds checking using ternary operators to guard all
num_clk_values-1 array accesses. When num_clk_values is 0, return 0
as fallback value instead of accessing invalid memory. This prevents
buffer overflows while maintaining backward compatibility and provides
sensible default behavior for empty clock tables.
Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Gabe Teeger <gabe.teeger@amd.com>
Signed-off-by: Chuanyu Tseng <chuanyu.tseng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions
