[PATCH] drm/sun4i: Check that the plane coordinates are not negative

Maxime Ripard maxime.ripard at free-electrons.com
Fri Sep 30 07:33:20 PDT 2016


Our planes cannot be set at negative coordinates. Make sure we reject such
configuration.

Reported-by: Boris Brezillon <boris.brezillon at free-electrons.com>
Signed-off-by: Maxime Ripard <maxime.ripard at free-electrons.com>
---
 drivers/gpu/drm/sun4i/sun4i_layer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun4i_layer.c b/drivers/gpu/drm/sun4i/sun4i_layer.c
index f0035bf5efea..f5463c4c2cde 100644
--- a/drivers/gpu/drm/sun4i/sun4i_layer.c
+++ b/drivers/gpu/drm/sun4i/sun4i_layer.c
@@ -29,6 +29,9 @@ struct sun4i_plane_desc {
 static int sun4i_backend_layer_atomic_check(struct drm_plane *plane,
 					    struct drm_plane_state *state)
 {
+	if ((state->crtc_x < 0) || (state->crtc_y < 0))
+		return -EINVAL;
+
 	return 0;
 }
 
-- 
2.9.3




More information about the linux-arm-kernel mailing list