From patchwork Fri Feb 17 17:54:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Starkey X-Patchwork-Id: 9580465 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 A4224600C5 for ; Fri, 17 Feb 2017 17:54:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9848328742 for ; Fri, 17 Feb 2017 17:54:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D62D28764; Fri, 17 Feb 2017 17:54:42 +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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4FD2D28742 for ; Fri, 17 Feb 2017 17:54:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0623C6ED94; Fri, 17 Feb 2017 17:54:41 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by gabe.freedesktop.org (Postfix) with ESMTP id 7E7976ED92 for ; Fri, 17 Feb 2017 17:54:38 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 64006C86; Fri, 17 Feb 2017 09:54:38 -0800 (PST) Received: from e106950-lin.cambridge.arm.com (e106950-lin.cambridge.arm.com [10.2.133.193]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C75833F578; Fri, 17 Feb 2017 09:54:37 -0800 (PST) From: Brian Starkey To: intel-gfx@lists.freedesktop.org Date: Fri, 17 Feb 2017 17:54:28 +0000 Message-Id: <1487354070-14487-3-git-send-email-brian.starkey@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1487354070-14487-1-git-send-email-brian.starkey@arm.com> References: <1487354070-14487-1-git-send-email-brian.starkey@arm.com> Subject: [Intel-gfx] [PATCH i-g-t 3/5] lib/igt_kms: Fix possible out-of-bounds access X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP If there's no primary plane, pipe->plane_primary == -1, and the assert meant to check that it's valid will access pipe->planes[-1]. Fix that to check that pipe->plane_primary has been set instead. Fixes: 36656239ef96 lib/igt_kms: Implement dynamic plane count support Signed-off-by: Brian Starkey Reviewed-by: Robert Foss --- lib/igt_kms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 783c891aebf1..45c90c71f301 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -1820,9 +1820,9 @@ void igt_display_init(igt_display_t *display, int drm_fd) /* * At the bare minimum, we should expect to have a primary - * plane + * plane, and it must be in slot 0. */ - igt_assert(pipe->planes[pipe->plane_primary].drm_plane); + igt_assert_eq(pipe->plane_primary, 0); if (display->has_cursor_plane) { /*