From: jsg Date: Mon, 9 Sep 2024 08:39:21 +0000 (+0000) Subject: drm/amd/pm: fix the Out-of-bounds read warning X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=75dce59b456df386f1a1be09a4261978c0cc0187;p=openbsd 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 --- 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++;