summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/i915
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-06-15 02:41:46 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-06-15 02:41:46 +0000
commit2b3eb2b616a54e3117c4a813c22ec8a4db6ee0ee (patch)
treed0b225294f74da0ef9c2d6b000b8c712f5774a41 /sys/dev/pci/drm/i915
parentecc9ca4ebd64b736eee7141880fec0ea0fc57a3b (diff)
drm/i915/dp: prevent potential div-by-zero
From Nikita Zhandarovich 86d73b1f98a81f3ecfc19dfe6f8d50daf5707330 in linux-6.1.y/6.1.30 0ff80028e2702c7c3d78b69705dc47c1ccba8c39 in mainline linux
Diffstat (limited to 'sys/dev/pci/drm/i915')
-rw-r--r--sys/dev/pci/drm/i915/display/intel_dp.c5
1 files changed, 5 insertions, 0 deletions
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;