From c57bd45d5cb3903f9afc7bd67b45c45c635ca861 Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 15 Jun 2023 02:41:45 +0000 Subject: [PATCH] drm/i915/dp: prevent potential div-by-zero From Nikita Zhandarovich 86d73b1f98a81f3ecfc19dfe6f8d50daf5707330 in linux-6.1.y/6.1.30 0ff80028e2702c7c3d78b69705dc47c1ccba8c39 in mainline linux --- sys/dev/pci/drm/i915/display/intel_dp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/pci/drm/i915/display/intel_dp.c b/sys/dev/pci/drm/i915/display/intel_dp.c index dd62aeae535..dd636c23a89 100644 --- a/sys/dev/pci/drm/i915/display/intel_dp.c +++ b/sys/dev/pci/drm/i915/display/intel_dp.c @@ -1512,6 +1512,11 @@ static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp, pipe_config->dsc.slice_count = drm_dp_dsc_sink_max_slice_count(intel_dp->dsc_dpcd, true); + if (!pipe_config->dsc.slice_count) { + drm_dbg_kms(&dev_priv->drm, "Unsupported Slice Count %d\n", + pipe_config->dsc.slice_count); + return -EINVAL; + } } else { u16 dsc_max_output_bpp; u8 dsc_dp_slice_count; -- 2.20.1