⬢ DragonFlyBSD Kernel Audit
DF-4037 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/amd/powerplay/smumgr/polaris10_smumgr.c
+++ b/sys/dev/drm/amd/powerplay/smumgr/polaris10_smumgr.c
@@ -709,9 +709,11 @@
 	 * We are populating vddc CAC data to BapmVddc table
 	 * in split and merged mode
 	 */
-	for (count = 0; count < lookup_table->count; count++) {
+	for (count = 0; count < lookup_table->count &&
+			count < SMU74_MAX_LEVELS_VDDC; count++) {
 		index = phm_get_voltage_index(lookup_table,
-				data->vddc_voltage_table.entries[count].value);
+				data->vddc_voltage_table.entries[count %
+					PP_ATOMCTRL_MAX_VOLTAGE_ENTRIES].value);
 		table->BapmVddcVidLoSidd[count] = convert_to_vid(lookup_table->entries[index].us_cac_low);
 		table->BapmVddcVidHiSidd[count] = convert_to_vid(lookup_table->entries[index].us_cac_mid);
 		table->BapmVddcVidHiSidd2[count] = convert_to_vid(lookup_table->entries[index].us_cac_high);