DF-3587 / fix.diff
diff --git a/sys/dev/drm/amd/amdgpu/si_dpm.c b/sys/dev/drm/amd/amdgpu/si_dpm.c --- a/sys/dev/drm/amd/amdgpu/si_dpm.c +++ b/sys/dev/drm/amd/amdgpu/si_dpm.c @@ -3211,6 +3211,10 @@ static u16 btc_find_voltage(struct atom_voltage_table *table, u16 voltage) if (voltage <= table->entries[i].value) return table->entries[i].value; + /* DF-3587: count == 0 makes count-1 wrap to 0xffffffff -> wild read. */ + if (table->count == 0) + return 0; + return table->entries[table->count - 1].value; } |