aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/pm
diff options
context:
space:
mode:
authorDenis Arefev <[email protected]>2025-03-21 10:52:31 +0000
committerAlex Deucher <[email protected]>2025-03-26 21:41:03 +0000
commitf23e9116ebb71b63fe9cec0dcac792aa9af30b0c (patch)
treeb37da3848ad16007c93976aab86263c3afea19ac /drivers/gpu/drm/amd/pm
parentMerge tag 'drm-intel-gt-next-2025-03-12' of https://gitlab.freedesktop.org/dr... (diff)
downloadkernel-f23e9116ebb71b63fe9cec0dcac792aa9af30b0c.tar.gz
kernel-f23e9116ebb71b63fe9cec0dcac792aa9af30b0c.zip
drm/amd/pm: 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: c05d1c401572 ("drm/amd/swsmu: add aldebaran smu13 ip support (v3)") Signed-off-by: Denis Arefev <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
Diffstat (limited to 'drivers/gpu/drm/amd/pm')
-rw-r--r--drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
index 0915d6377613..ba5a9012dbd5 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
@@ -1226,7 +1226,7 @@ int smu_v13_0_set_fan_speed_rpm(struct smu_context *smu,
uint32_t tach_period;
int ret;
- if (!speed)
+ if (!speed || speed > UINT_MAX/8)
return -EINVAL;
ret = smu_v13_0_auto_fan_control(smu, 0);