Skip to contentSkip to conversation

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

PATCH In review Yang Wang 2 participants 2 messages Oct 22, 2025

Subsystems (3)
lore
Share & tools
lore

Yang Wang

author
#0 lore raw

PATCH 1/1 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 caad2613dc4bd ("drm/amd/powerplay: move table setting common code to smu_cmn.c")
---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +1 -1
index f532f7c69259..a8961a8f5c42 100644
@@ -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;
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Regards,
Hawking
-----Original Message-----
From: Wang, Yang(Kevin) <[email protected]>
Sent: Wednesday, October 22, 2025 14:29
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH] 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 caad2613dc4bd ("drm/amd/powerplay: move table setting common code to smu_cmn.c")
---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +1 -1
index f532f7c69259..a8961a8f5c42 100644
@@ -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;

--
2.34.1