Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 031db09017da ("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

authored by

Denis Arefev and committed by
Alex Deucher
4e3d9508 7d641c2b

+1 -1
+1 -1
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_thermal.c
··· 191 191 uint32_t tach_period, crystal_clock_freq; 192 192 int result = 0; 193 193 194 - if (!speed) 194 + if (!speed || speed > UINT_MAX/8) 195 195 return -EINVAL; 196 196 197 197 if (PP_CAP(PHM_PlatformCaps_MicrocodeFanControl)) {