summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-09-09 08:39:22 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-09-09 08:39:22 +0000
commit5cced6366390f27a998968bedadfb06775bedd8a (patch)
tree68243fa1d98770185096c10ac9ab860e78a018ae /sys
parentcf9b0b92c648ec25547a060318f9741017e6f1dc (diff)
drm/amd/pm: fix the Out-of-bounds read warning
From Jesse Zhang f1e261ced9bcad772a45a2fcdf413c3490e87299 in linux-6.6.y/6.6.50 12c6967428a099bbba9dfd247bb4322a984fcc0b in mainline linux
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c b/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c
index f503e61faa6..cc3b62f7339 100644
--- a/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c
+++ b/sys/dev/pci/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c
@@ -73,8 +73,9 @@ static int atomctrl_retrieve_ac_timing(
j++;
} else if ((table->mc_reg_address[i].uc_pre_reg_data &
LOW_NIBBLE_MASK) == DATA_EQU_PREV) {
- table->mc_reg_table_entry[num_ranges].mc_data[i] =
- table->mc_reg_table_entry[num_ranges].mc_data[i-1];
+ if (i)
+ table->mc_reg_table_entry[num_ranges].mc_data[i] =
+ table->mc_reg_table_entry[num_ranges].mc_data[i-1];
}
}
num_ranges++;