]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/display: Check denominator pbn_div before used
authorAlex Hung <alex.hung@amd.com>
Tue, 18 Jun 2024 22:21:20 +0000 (16:21 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Sep 2024 09:11:31 +0000 (11:11 +0200)
[ Upstream commit 116a678f3a9abc24f5c9d2525b7393d18d9eb58e ]

[WHAT & HOW]
A denominator cannot be 0, and is checked before used.

This fixes 1 DIVIDE_BY_ZERO issue reported by Coverity.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Jerry Zuo <jerry.zuo@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 44c1556838240b1df7f7ffd834e8ecb4df278654..f0ebf686b06f220f6524b80d4c304aa3c88514e5 100644 (file)
@@ -6937,7 +6937,7 @@ static int dm_update_mst_vcpi_slots_for_dsc(struct drm_atomic_state *state,
                        }
                }
 
-               if (j == dc_state->stream_count)
+               if (j == dc_state->stream_count || pbn_div == 0)
                        continue;
 
                slot_num = DIV_ROUND_UP(pbn, pbn_div);