summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2022-02-09 04:29:03 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2022-02-09 04:29:03 +0000
commitf31c3ed7bb9d7a2683c2e65eb77a736421b16761 (patch)
tree6c27448b73d25aba2ed6dc340fc69c5489286730 /sys/dev/pci/drm
parentef062e3c0826d2c342fd871bc58c2d99f7f00c95 (diff)
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
Diffstat (limited to 'sys/dev/pci/drm')
-rw-r--r--sys/dev/pci/drm/i915/display/intel_overlay.c3
1 files changed, 3 insertions, 0 deletions
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 &&