⬢ DragonFlyBSD Kernel Audit
DF-3704 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/sys/dev/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -4881,7 +4881,9 @@ static int vega10_odn_edit_dpm_table(
 	}
 
 	for (i = 0; i < size; i += 3) {
-		if (i + 3 > size || input[i] >= podn_vdd_dep_table->count) {
+		/* input[i] is a signed long: negatives pass a plain >= uint8 count
+		 * compare and then index entries[] with a huge uint32. */
+		if (i + 3 > size || input[i] < 0 ||
+				input[i] >= podn_vdd_dep_table->count) {
 			pr_info("invalid clock voltage input\n");
 			return 0;
 		}