[Intel-gfx] [PATCH 1/9] drm: Warn about negative sizes when calculating scale factor

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Tue Jul 26 16:06:56 UTC 2016


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

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 at linux.intel.com>
---
 drivers/gpu/drm/drm_rect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
index a8e2c8603945..512199b60728 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)
-- 
2.7.4



More information about the Intel-gfx mailing list