diff options
author | Alex Deucher <[email protected]> | 2024-05-20 09:11:45 -0400 |
---|---|---|
committer | Alex Deucher <[email protected]> | 2024-06-19 18:25:37 -0400 |
commit | a498df5421fd737d11bfd152428ba6b1c8538321 (patch) | |
tree | 98e4a15966e4444e63229b72217a7b84926c2688 | |
parent | 301daa346f0e34a87fb6c1e4a05db2aa0a66b573 (diff) |
drm/radeon: fix UBSAN warning in kv_dpm.c
Adds bounds check for sumo_vid_mapping_entry.
Reviewed-by: Mario Limonciello <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Cc: [email protected]
-rw-r--r-- | drivers/gpu/drm/radeon/sumo_dpm.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/sumo_dpm.c b/drivers/gpu/drm/radeon/sumo_dpm.c index 21d27e6235f3..b11f7c5bbcbe 100644 --- a/drivers/gpu/drm/radeon/sumo_dpm.c +++ b/drivers/gpu/drm/radeon/sumo_dpm.c @@ -1619,6 +1619,8 @@ void sumo_construct_vid_mapping_table(struct radeon_device *rdev, for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) { if (table[i].ulSupportedSCLK != 0) { + if (table[i].usVoltageIndex >= SUMO_MAX_NUMBER_VOLTAGES) + continue; vid_mapping_table->entries[table[i].usVoltageIndex].vid_7bit = table[i].usVoltageID; vid_mapping_table->entries[table[i].usVoltageIndex].vid_2bit = |