aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/pm
diff options
context:
space:
mode:
authorDenis Arefev <[email protected]>2025-03-20 09:35:02 +0000
committerAlex Deucher <[email protected]>2025-04-09 14:53:11 +0000
commit7ba88b5cccc1a99c1afb96e31e7eedac9907704c (patch)
treeb7568c2816c541e2376ac712e762a35b5d1adabc /drivers/gpu/drm/amd/pm
parentdrm/amdgpu: cancel gfx idle work in device suspend for s0ix (diff)
downloadkernel-7ba88b5cccc1a99c1afb96e31e7eedac9907704c.tar.gz
kernel-7ba88b5cccc1a99c1afb96e31e7eedac9907704c.zip
drm/amd/pm/smu11: Prevent division by zero
The user can set any speed value. If speed is greater than UINT_MAX/8, division by zero is possible. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 1e866f1fe528 ("drm/amd/pm: Prevent divide by zero") Signed-off-by: Denis Arefev <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit da7dc714a8f8e1c9fc33c57cd63583779a3bef71) Cc: [email protected]
Diffstat (limited to 'drivers/gpu/drm/amd/pm')
-rw-r--r--drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
index 78391d8f35a9..25fabf336a64 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -1204,7 +1204,7 @@ int smu_v11_0_set_fan_speed_rpm(struct smu_context *smu,
uint32_t crystal_clock_freq = 2500;
uint32_t tach_period;
- if (speed == 0)
+ if (!speed || speed > UINT_MAX/8)
return -EINVAL;
/*
* To prevent from possible overheat, some ASICs may have requirement