DragonFlyBSD Kernel Audit
DF-1346 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/drm/amd/powerplay/smumgr/polaris10_smumgr.c b/sys/dev/drm/amd/powerplay/smumgr/polaris10_smumgr.c
--- a/sys/dev/drm/amd/powerplay/smumgr/polaris10_smumgr.c
+++ b/sys/dev/drm/amd/powerplay/smumgr/polaris10_smumgr.c
@@ -1295,7 +1295,8 @@
 	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
 	uint32_t vddci;
 
-	table->VceLevelCount = (uint8_t)(mm_table->count);
+	table->VceLevelCount = (uint8_t)((SMU74_MAX_LEVELS_VCE < mm_table->count) ?
+						SMU74_MAX_LEVELS_VCE : mm_table->count);
 	table->VceBootLevel = 0;
 
 	for (count = 0; count < table->VceLevelCount; count++) {
@@ -1401,7 +1402,8 @@
 	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
 	uint32_t vddci;
 
-	table->UvdLevelCount = (uint8_t)(mm_table->count);
+	table->UvdLevelCount = (uint8_t)((SMU74_MAX_LEVELS_UVD < mm_table->count) ?
+						SMU74_MAX_LEVELS_UVD : mm_table->count);
 	table->UvdBootLevel = 0;
 
 	for (count = 0; count < table->UvdLevelCount; count++) {