drm/i915/overlay: Prevent divide by zero bugs in scaling
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 24 Jan 2022 12:24:09 +0000 (15:24 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 25 Jan 2022 05:13:06 +0000 (07:13 +0200)
commitcf5b64f7f10b28bebb9b7c9d25e7aee5cbe43918
tree5cf343e1ac2fa2ae0652cab7b77c2f10134d1512
parentc9b06cc26f1daace605238adb4720560078b0eb6
drm/i915/overlay: Prevent divide by zero bugs in scaling

Smatch detected a divide by zero bug in check_overlay_scaling().

    drivers/gpu/drm/i915/display/intel_overlay.c:976 check_overlay_scaling()
    error: potential divide by zero bug '/ rec->dst_height'.
    drivers/gpu/drm/i915/display/intel_overlay.c:980 check_overlay_scaling()
    error: potential divide by zero bug '/ rec->dst_width'.

Prevent this by ensuring that the dst height and width are non-zero.

Fixes: 02e792fbaadb ("drm/i915: implement drmmode overlay support v4")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220124122409.GA31673@kili
drivers/gpu/drm/i915/display/intel_overlay.c