diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-05-27 00:51:32 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-05-27 00:51:32 +0000 |
commit | f43caa0206e72c3c602676665867ac1e0e484e52 (patch) | |
tree | 40281b966cab9ad2cb2ec00433f5a91ca6f9ebb2 | |
parent | 73791d35e58c410cda095cae576c5dc4f4c6db62 (diff) |
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
-rw-r--r-- | sys/dev/pci/drm/amd/display/dc/dsc/dc_dsc.c | 7 |
1 files changed, 6 insertions, 1 deletions
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( |