From 0d1a5d29364b4acda98e3bea73ce71f95fbfe79b Mon Sep 17 00:00:00 2001 From: jsg Date: Wed, 9 Feb 2022 04:29:02 +0000 Subject: [PATCH] drm/i915/overlay: Prevent divide by zero bugs in scaling From Dan Carpenter 5cba71707f0a7fe19fa1feaf25a4c094876c2db1 in linux 5.15.y/5.15.22 90a3d22ff02b196d5884e111f39271a1d4ee8e3e in mainline linux --- sys/dev/pci/drm/i915/display/intel_overlay.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/pci/drm/i915/display/intel_overlay.c b/sys/dev/pci/drm/i915/display/intel_overlay.c index 6712f8dab2e..2f09b740921 100644 --- a/sys/dev/pci/drm/i915/display/intel_overlay.c +++ b/sys/dev/pci/drm/i915/display/intel_overlay.c @@ -959,6 +959,9 @@ static int check_overlay_dst(struct intel_overlay *overlay, const struct intel_crtc_state *pipe_config = overlay->crtc->config; + if (rec->dst_height == 0 || rec->dst_width == 0) + return -EINVAL; + if (rec->dst_x < pipe_config->pipe_src_w && rec->dst_x + rec->dst_width <= pipe_config->pipe_src_w && rec->dst_y < pipe_config->pipe_src_h && -- 2.20.1