Skip to content

Commit

Permalink
drm/amd/pm: Prevent division by zero
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Denis Arefev authored and Alex Deucher committed Mar 26, 2025
1 parent cf05922 commit f23e911
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f23e911

Please sign in to comment.