mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
drm/amd/pm: Prevent division by zero
[ Upstream commit 4e3d9508c056d7e0a56b58d5c81253e2a0d22b6c ]
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: 031db09017 ("drm/amd/powerplay/vega20: enable fan RPM and pwm settings V2")
Signed-off-by: Denis Arefev <arefev@swemel.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
ce5af106a0
commit
6b9f9b998b
1 changed files with 1 additions and 1 deletions
|
|
@ -189,7 +189,7 @@ int vega20_fan_ctrl_set_fan_speed_rpm(struct pp_hwmgr *hwmgr, uint32_t speed)
|
|||
uint32_t tach_period, crystal_clock_freq;
|
||||
int result = 0;
|
||||
|
||||
if (!speed)
|
||||
if (!speed || speed > UINT_MAX/8)
|
||||
return -EINVAL;
|
||||
|
||||
if (PP_CAP(PHM_PlatformCaps_MicrocodeFanControl)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue