drm/amd/display: Fix division by zero in setup_dsc_config
authorjsg <jsg@openbsd.org>
Mon, 27 May 2024 00:51:31 +0000 (00:51 +0000)
committerjsg <jsg@openbsd.org>
Mon, 27 May 2024 00:51:31 +0000 (00:51 +0000)
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

index 3966845..230be29 100644 (file)
@@ -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(