diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2016-09-14 19:24:25 +0800 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-09-19 13:22:08 -0400 |
commit | c07aefc268acf53c551dbd50d4fc08a82bee899f (patch) | |
tree | f4d3faccf90230fa7cdc2ab753676e27ee4b98f7 /drivers/gpu/drm/amd/powerplay | |
parent | 9716ebc38dfabe6c8e5e3c809e9f3c61dd3740f9 (diff) | |
download | talos-obmc-linux-c07aefc268acf53c551dbd50d4fc08a82bee899f.tar.gz talos-obmc-linux-c07aefc268acf53c551dbd50d4fc08a82bee899f.zip |
drm/amd/powerplay: fix potential issue of array access violation
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c index 524d0dd4f0e9..4f82a06ba3e2 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c @@ -388,12 +388,9 @@ int phm_reset_single_dpm_table(void *table, struct vi_dpm_table *dpm_table = (struct vi_dpm_table *)table; - PP_ASSERT_WITH_CODE(count <= max, - "Fatal error, can not set up single DPM table entries to exceed max number!", - ); + dpm_table->count = count > max ? max : count; - dpm_table->count = count; - for (i = 0; i < max; i++) + for (i = 0; i < dpm_table->count; i++) dpm_table->dpm_level[i].enabled = false; return 0; |