From a682ea72191ddaaa78a7a85eb6d0ee90a1454d74 Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 27 May 2024 00:51:31 +0000 Subject: [PATCH] drm/amd/display: Fix division by zero in setup_dsc_config From Jose Fernandez 7e4f50dfc98c49b3dc6875a35c3112522fb25639 in linux-6.6.y/6.6.32 130afc8a886183a94cf6eab7d24f300014ff87ba in mainline linux --- sys/dev/pci/drm/amd/display/dc/dsc/dc_dsc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/drm/amd/display/dc/dsc/dc_dsc.c b/sys/dev/pci/drm/amd/display/dc/dsc/dc_dsc.c index 3966845c769..230be292ff3 100644 --- a/sys/dev/pci/drm/amd/display/dc/dsc/dc_dsc.c +++ b/sys/dev/pci/drm/amd/display/dc/dsc/dc_dsc.c @@ -1033,7 +1033,12 @@ static bool setup_dsc_config( if (!is_dsc_possible) goto done; - dsc_cfg->num_slices_v = pic_height/slice_height; + if (slice_height > 0) { + dsc_cfg->num_slices_v = pic_height / slice_height; + } else { + is_dsc_possible = false; + goto done; + } if (target_bandwidth_kbps > 0) { is_dsc_possible = decide_dsc_target_bpp_x16( -- 2.20.1