summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsad Kamal <asad.kamal@amd.com>2026-06-03 15:11:33 +0800
committerAlex Deucher <alexander.deucher@amd.com>2026-06-04 15:25:58 -0400
commitd2be142124f40be1e5b6c7d25e9f9069bc874c1f (patch)
treeccb77bda94a8f329e95afb593b5459aabb1b3d1d
parent01112e241e37f9ac98b6f418d93ce2e0b87b7ee0 (diff)
downloadlinux-d2be142124f40be1e5b6c7d25e9f9069bc874c1f.tar.gz
linux-d2be142124f40be1e5b6c7d25e9f9069bc874c1f.zip
drm/amd/pm: Stop pp_od_clk_voltage emit at PAGE_SIZE
Stop appending OD sections in amdgpu_get_pp_od_clk_voltage() once the sysfs page is full, instead of checking every sysfs_emit_at() in SMU helpers. This is purely defensive hardening. v2: Drop the prior series that checked sysfs_emit_at() return values in every SMU *_emit_clk_levels() helper and smu_cmn_print_*().(Kevin) v3: Update description, remove all clamping Signed-off-by: Asad Kamal <asad.kamal@amd.com> Reviewed-by: Yang Wang <kevinyang.wang@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/pm/amdgpu_pm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
index 52e5cbcac352..714c702b4f8c 100644
--- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
@@ -874,6 +874,8 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
for (clk_index = 0 ; clk_index < ARRAY_SIZE(od_clocks) ; clk_index++) {
amdgpu_dpm_emit_clock_levels(adev, od_clocks[clk_index], buf, &size);
+ if (unlikely(size >= (PAGE_SIZE - 1)))
+ break;
}
if (size == 0)