Skip to content

Commit f23e911

Browse files
Denis Arefevalexdeucher
authored andcommitted
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: c05d1c4 ("drm/amd/swsmu: add aldebaran smu13 ip support (v3)") Signed-off-by: Denis Arefev <arefev@swemel.ru> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent cf05922 commit f23e911

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ int smu_v13_0_set_fan_speed_rpm(struct smu_context *smu,
12261226
uint32_t tach_period;
12271227
int ret;
12281228

1229-
if (!speed)
1229+
if (!speed || speed > UINT_MAX/8)
12301230
return -EINVAL;
12311231

12321232
ret = smu_v13_0_auto_fan_control(smu, 0);

0 commit comments

Comments
 (0)