]> www.infradead.org Git - nvme.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)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 1 Jul 2024 20:06:53 +0000 (16:06 -0400)
[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>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 0daf2b787d2f3941605460106b54a71bde9a84ef..2c96863d320e1e00e9bd2b90c36548bd372c0666 100644 (file)
@@ -7561,7 +7561,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);