From: Ville Syrjälä Date: Tue, 26 Jul 2016 16:06:56 +0000 (+0300) Subject: drm: Warn about negative sizes when calculating scale factor X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1e1a5f8f8c3a4b24b3fc0340880cf1e3949f4997;p=linux-beck.git drm: Warn about negative sizes when calculating scale factor Passing negative width/hight to scale factor calculations is not legal. Let's WARN if that happens. Signed-off-by: Ville Syrjälä Signed-off-by: Sean Paul Link: http://patchwork.freedesktop.org/patch/msgid/1469549224-1860-2-git-send-email-ville.syrjala@linux.intel.com --- diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c index 4063f6e4ea9f..73e53a8d1b37 100644 --- a/drivers/gpu/drm/drm_rect.c +++ b/drivers/gpu/drm/drm_rect.c @@ -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)