[Intel-gfx] [PATCH 05/13] drm: Also check unused fields for addfb2

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Tue Feb 10 09:16:08 PST 2015


From: Daniel Vetter <daniel.vetter at ffwll.ch>

Just the usual paranoia ...

v2: Fixed format strings. (Tvrtko Ursulin)

Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/drm_crtc.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index e6e2de3..61e7163 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -3269,6 +3269,23 @@ static int framebuffer_check(const struct drm_mode_fb_cmd2 *r)
 		}
 	}
 
+	for (; i < 4; i++) {
+		if (r->handles[i]) {
+			DRM_DEBUG_KMS("buffer object handle for unused plane %d\n", i);
+			return -EINVAL;
+		}
+
+		if (r->pitches[i] || r->offsets[i]) {
+			DRM_DEBUG_KMS("buffer pitch/offset for unused plane %d", i);
+			return -EINVAL;
+		}
+
+		if (r->modifier[i]) {
+			DRM_DEBUG_KMS("fb modifer for unused plane %d", i);
+			return -EINVAL;
+		}
+	}
+
 	return 0;
 }
 
-- 
2.2.2



More information about the Intel-gfx mailing list