From patchwork Fri Sep 30 14:33:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 9358409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BCB336077B for ; Fri, 30 Sep 2016 14:35:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC0B327EED for ; Fri, 30 Sep 2016 14:35:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E0DC2A061; Fri, 30 Sep 2016 14:35:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5785829F13 for ; Fri, 30 Sep 2016 14:35:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bpyst-0003wB-19; Fri, 30 Sep 2016 14:33:55 +0000 Received: from down.free-electrons.com ([37.187.137.238] helo=mail.free-electrons.com) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bpysl-0003qa-3Z for linux-arm-kernel@lists.infradead.org; Fri, 30 Sep 2016 14:33:50 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id 72811A67; Fri, 30 Sep 2016 16:33:25 +0200 (CEST) Received: from localhost (per18-1-82-246-202-189.fbx.proxad.net [82.246.202.189]) by mail.free-electrons.com (Postfix) with ESMTPSA id 2B62F221; Fri, 30 Sep 2016 16:33:25 +0200 (CEST) From: Maxime Ripard To: Daniel Vetter , David Airlie Subject: [PATCH] drm/sun4i: Check that the plane coordinates are not negative Date: Fri, 30 Sep 2016 16:33:20 +0200 Message-Id: <20160930143320.26241-1-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.9.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160930_073347_376193_383A7D6F X-CRM114-Status: GOOD ( 10.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, Boris Brezillon , Chen-Yu Tsai , Maxime Ripard , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Our planes cannot be set at negative coordinates. Make sure we reject such configuration. Reported-by: Boris Brezillon Signed-off-by: Maxime Ripard --- 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; }