DragonFlyBSD Kernel Audit
DF-1418 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/drm/amd/powerplay/hwmgr/smu8_hwmgr.c b/sys/dev/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
--- a/sys/dev/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
+++ b/sys/dev/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
@@ -1351,6 +1351,8 @@
 
 	if (clock_info_index > (uint8_t)(hwmgr->platform_descriptor.hardwareActivityPerformanceLevels - 1))
 		clock_info_index = (uint8_t)(hwmgr->platform_descriptor.hardwareActivityPerformanceLevels - 1);
+	if (table && clock_info_index >= table->count)
+		clock_info_index = table->count - 1;
 
 	smu8_ps->levels[index].engineClock = table->entries[clock_info_index].clk;
 	smu8_ps->levels[index].vddcIndex = (uint8_t)table->entries[clock_info_index].v;