Commit 7ba88b5c authored by Denis Arefev's avatar Denis Arefev Committed by Alex Deucher
Browse files

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: 1e866f1f ("drm/amd/pm: Prevent divide by zero")
Signed-off-by: default avatarDenis Arefev <arefev@swemel.ru>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
(cherry picked from commit da7dc714)
Cc: stable@vger.kernel.org
parent 35a54408
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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