Skip to content

Commit 41a33b1

Browse files
Denis Arefevvijay-suman
authored andcommitted
drm/amd/pm/swsmu/smu13/smu_v13_0: Prevent division by zero
commit f23e9116ebb71b63fe9cec0dcac792aa9af30b0c upstream. 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 <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit f2904fa2b9da943db6bef7c0f8b3fb4fc14acbc4) Signed-off-by: Vijayendra Suman <[email protected]>
1 parent ac4931e commit 41a33b1

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
@@ -1154,7 +1154,7 @@ int smu_v13_0_set_fan_speed_rpm(struct smu_context *smu,
11541154
int ret;
11551155
uint32_t tach_period, crystal_clock_freq;
11561156

1157-
if (!speed)
1157+
if (!speed || speed > UINT_MAX/8)
11581158
return -EINVAL;
11591159

11601160
ret = smu_v13_0_auto_fan_control(smu, 0);

0 commit comments

Comments
 (0)