From: jsg Date: Mon, 27 May 2024 00:51:31 +0000 (+0000) Subject: drm/amd/display: Fix division by zero in setup_dsc_config X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a682ea72191ddaaa78a7a85eb6d0ee90a1454d74;p=openbsd 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 --- 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(