drm: Warn about negative sizes when calculating scale factor
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 26 Jul 2016 16:06:56 +0000 (19:06 +0300)
committerSean Paul <seanpaul@chromium.org>
Mon, 8 Aug 2016 18:17:56 +0000 (14:17 -0400)
Passing negative width/hight to scale factor calculations is not
legal. Let's WARN if that happens.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1469549224-1860-2-git-send-email-ville.syrjala@linux.intel.com
drivers/gpu/drm/drm_rect.c

index 4063f6e4ea9fff9a23082c9121e809248bdeb35d..73e53a8d1b37c08a64ea862dacf51739fe85c15a 100644 (file)
@@ -100,7 +100,7 @@ static int drm_calc_scale(int src, int dst)
 {
        int scale = 0;
 
-       if (src < 0 || dst < 0)
+       if (WARN_ON(src < 0 || dst < 0))
                return -EINVAL;
 
        if (dst == 0)