Commit 658b9391 authored by Rex Zhu's avatar Rex Zhu Committed by Alex Deucher

drm/amd/pp: Fix overflow when setup decf/pix/disp dpm table.

Clear the count in the single table setup function to
avoid missing any tables.
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarRex Zhu <Rex.Zhu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1ed05ff4
...@@ -1161,6 +1161,8 @@ static void vega10_setup_default_single_dpm_table(struct pp_hwmgr *hwmgr, ...@@ -1161,6 +1161,8 @@ static void vega10_setup_default_single_dpm_table(struct pp_hwmgr *hwmgr,
{ {
int i; int i;
dpm_table->count = 0;
for (i = 0; i < dep_table->count; i++) { for (i = 0; i < dep_table->count; i++) {
if (i == 0 || dpm_table->dpm_levels[dpm_table->count - 1].value <= if (i == 0 || dpm_table->dpm_levels[dpm_table->count - 1].value <=
dep_table->entries[i].clk) { dep_table->entries[i].clk) {
...@@ -1269,10 +1271,6 @@ static int vega10_setup_default_dpm_tables(struct pp_hwmgr *hwmgr) ...@@ -1269,10 +1271,6 @@ static int vega10_setup_default_dpm_tables(struct pp_hwmgr *hwmgr)
return -EINVAL); return -EINVAL);
/* Initialize Sclk DPM table based on allow Sclk values */ /* Initialize Sclk DPM table based on allow Sclk values */
data->dpm_table.soc_table.count = 0;
data->dpm_table.gfx_table.count = 0;
data->dpm_table.dcef_table.count = 0;
dpm_table = &(data->dpm_table.soc_table); dpm_table = &(data->dpm_table.soc_table);
vega10_setup_default_single_dpm_table(hwmgr, vega10_setup_default_single_dpm_table(hwmgr,
dpm_table, dpm_table,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment