amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: use proper index in smu_v13_0_7_get_power_profile_mode()
@ 2022-05-06 14:06 Alex Deucher
  2022-05-07  1:35 ` 答复: " Feng, Kenneth
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Deucher @ 2022-05-06 14:06 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, Stephen Rothwell, Kenneth Feng

Otherwise we get an out of bounds access.

Fixes: 878205b8c170 ("drm/amd/pm: enable workload type change on smu_v13_0_7")
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Kenneth Feng <kenneth.feng@amd.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
index 8e576054bee5..cf5800822174 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
@@ -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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* 答复: [PATCH] drm/amdgpu: use proper index in smu_v13_0_7_get_power_profile_mode()
  2022-05-06 14:06 [PATCH] drm/amdgpu: use proper index in smu_v13_0_7_get_power_profile_mode() Alex Deucher
@ 2022-05-07  1:35 ` Feng, Kenneth
  0 siblings, 0 replies; 2+ messages in thread
From: Feng, Kenneth @ 2022-05-07  1:35 UTC (permalink / raw)
  To: Deucher, Alexander, amd-gfx; +Cc: Deucher, Alexander, Stephen Rothwell

[-- Attachment #1: Type: text/plain, Size: 2037 bytes --]

[AMD Official Use Only - General]

Reviewed-by: Kenneth Feng <kenneth.feng@amd.com<mailto:kenneth.feng@amd.com>>

Best wishes
Kenneth Feng


发件人: Deucher, Alexander <Alexander.Deucher@amd.com>
日期: 星期五, 2022年5月6日 22:07
收件人: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
抄送: Deucher, Alexander <Alexander.Deucher@amd.com>, Feng, Kenneth <Kenneth.Feng@amd.com>, Stephen Rothwell <sfr@canb.auug.org.au>
主题: [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")
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Kenneth Feng <kenneth.feng@amd.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
index 8e576054bee5..cf5800822174 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
@@ -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

[-- Attachment #2: Type: text/html, Size: 8686 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-07  1:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 14:06 [PATCH] drm/amdgpu: use proper index in smu_v13_0_7_get_power_profile_mode() Alex Deucher
2022-05-07  1:35 ` 答复: " Feng, Kenneth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).