Commit 238d468d authored by Yang Wang's avatar Yang Wang Committed by Alex Deucher
Browse files

drm/amd/pm: fix smu table id bound check issue in smu_cmn_update_table()



'table_index' is a variable defined by the smu driver (kmd)
'table_id' is a variable defined by the hw smu (pmfw)

This code should use table_index as a bounds check.

Fixes: caad2613 ("drm/amd/powerplay: move table setting common code to smu_cmn.c")
Signed-off-by: default avatarYang Wang <kevinyang.wang@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
(cherry picked from commit fca0c66b)
parent 382bd6a7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -969,7 +969,7 @@ int smu_cmn_update_table(struct smu_context *smu,
						      table_index);
	uint32_t table_size;
	int ret = 0;
	if (!table_data || table_id >= SMU_TABLE_COUNT || table_id < 0)
	if (!table_data || table_index >= SMU_TABLE_COUNT || table_id < 0)
		return -EINVAL;

	table_size = smu_table->tables[table_index].size;