DragonFlyBSD Kernel Audit
DF-1817 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/drm/amd/powerplay/hwmgr/ppatomfwctrl.c b/sys/dev/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
--- a/sys/dev/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
+++ b/sys/dev/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
@@ -123,7 +123,8 @@
 
 		if (!result) {
 			for (i = 0; i < voltage_object->gpio_voltage_obj.
-							gpio_entry_num; i++) {
+							gpio_entry_num &&
+			     i < PP_ATOMFWCTRL_MAX_VOLTAGE_ENTRIES; i++) {
 				voltage_table->entries[i].value =
 						le16_to_cpu(voltage_object->gpio_voltage_obj.
 						voltage_gpio_lut[i].voltage_level_mv);