]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amd/display: prevent potential division by zero errors
authorHamza Mahfooz <hamza.mahfooz@amd.com>
Tue, 5 Sep 2023 17:27:22 +0000 (13:27 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2023 10:28:06 +0000 (12:28 +0200)
commitff536a96687cf976d89bed08d40fcaae6bf50304
treef6c4fa7212a65e2cc7e37f72aaed1655f3e84976
parente1769b1dfcaebb7e4272528fa2f198c6549f619b
drm/amd/display: prevent potential division by zero errors

commit 07e388aab042774f284a2ad75a70a194517cdad4 upstream.

There are two places in apply_below_the_range() where it's possible for
a divide by zero error to occur. So, to fix this make sure the divisor
is non-zero before attempting the computation in both cases.

Cc: stable@vger.kernel.org
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2637
Fixes: a463b263032f ("drm/amd/display: Fix frames_to_insert math")
Fixes: ded6119e825a ("drm/amd/display: Reinstate LFC optimization")
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/display/modules/freesync/freesync.c