Skip to content

Commit f00dbb0

Browse files
alexdeuchersfX-bot
authored andcommitted
drm/amdgpu: fix UBSAN warning in kv_dpm.c
[ Upstream commit f0d576f840153392d04b2d52cf3adab8f62e8cb6 ] Adds bounds check for sumo_vid_mapping_entry. Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3392 Reviewed-by: Mario Limonciello <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent cf16b90 commit f00dbb0

File tree

1 file changed

+2
-0
lines changed
  • drivers/gpu/drm/amd/pm/powerplay

1 file changed

+2
-0
lines changed

drivers/gpu/drm/amd/pm/powerplay/kv_dpm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ static void sumo_construct_vid_mapping_table(struct amdgpu_device *adev,
163163

164164
for (i = 0; i < SUMO_MAX_HARDWARE_POWERLEVELS; i++) {
165165
if (table[i].ulSupportedSCLK != 0) {
166+
if (table[i].usVoltageIndex >= SUMO_MAX_NUMBER_VOLTAGES)
167+
continue;
166168
vid_mapping_table->entries[table[i].usVoltageIndex].vid_7bit =
167169
table[i].usVoltageID;
168170
vid_mapping_table->entries[table[i].usVoltageIndex].vid_2bit =

0 commit comments

Comments
 (0)