drm/i915/dp: prevent potential div-by-zero
authorjsg <jsg@openbsd.org>
Thu, 15 Jun 2023 02:41:45 +0000 (02:41 +0000)
committerjsg <jsg@openbsd.org>
Thu, 15 Jun 2023 02:41:45 +0000 (02:41 +0000)
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

index dd62aea..dd636c2 100644 (file)
@@ -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;