Skip to contentSkip to conversation

drm/amdgpu: use proper index in smu_v13_0_7_get_power_profile_mode()

PATCH In review Alex Deucher 2 participants 2 messages May 6, 2022 – May 7, 2022

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: use proper index in smu_v13_0_7_get_power_profile_mode()

Otherwise we get an out of bounds access.

Fixes 878205b8c170 ("drm/amd/pm: enable workload type change on smu_v13_0_7")
Cc Kenneth Feng <[email protected]>
Cc Stephen Rothwell <[email protected]>
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +1 -1
index 8e576054bee5..cf5800822174 100644
@@ -1361,7 +1361,7 @@ static int smu_v13_0_7_get_power_profile_mode(struct smu_context *smu, char *buf
 do {													\
 	size += sysfs_emit_at(buf, size, "%-30s", #field);						\
 	for (j = 0; j <= PP_SMC_POWER_PROFILE_WINDOW3D; j++)						\
-		size += sysfs_emit_at(buf, size, "%-16d", activity_monitor_external[i].DpmActivityMonitorCoeffInt.field);		\
+		size += sysfs_emit_at(buf, size, "%-16d", activity_monitor_external[j].DpmActivityMonitorCoeffInt.field);		\
 	size += sysfs_emit_at(buf, size, "\n");								\
 } while (0)
 
Signature · 1 line
2.35.1
maintainer Reviewed-by Kenneth Feng on v1 1/1
#1 lore raw

[AMD Official Use Only - General]

Best wishes
Kenneth Feng

发件人: Deucher, Alexander <[email protected]>
日期: 星期五, 2022年5月6日 22:07
收件人: [email protected] <[email protected]>
抄送: Deucher, Alexander <[email protected]>, Feng, Kenneth <[email protected]>, Stephen Rothwell <[email protected]> 主题: [PATCH] drm/amdgpu: use proper index in smu_v13_0_7_get_power_profile_mode()
Otherwise we get an out of bounds access.

Fixes 878205b8c170 ("drm/amd/pm: enable workload type change on smu_v13_0_7")
Cc Kenneth Feng <[email protected]>
Cc Stephen Rothwell <[email protected]>
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +1 -1
index 8e576054bee5..cf5800822174 100644
@@ -1361,7 +1361,7 @@ static int smu_v13_0_7_get_power_profile_mode(struct smu_context *smu, char *buf
 do {                                                                                                    \
         size += sysfs_emit_at(buf, size, "%-30s", #field);                                              \
         for (j = 0; j <= PP_SMC_POWER_PROFILE_WINDOW3D; j++)                                            \
-               size += sysfs_emit_at(buf, size, "%-16d", activity_monitor_external[i].DpmActivityMonitorCoeffInt.field);               \
+               size += sysfs_emit_at(buf, size, "%-16d", activity_monitor_external[j].DpmActivityMonitorCoeffInt.field);               \
         size += sysfs_emit_at(buf, size, "\n");                                                         \
 } while (0)
 

--
2.35.1