From patchwork Fri Feb 12 16:31:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Peres X-Patchwork-Id: 8293361 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 783D7C02AA for ; Fri, 12 Feb 2016 16:32:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A837C200E3 for ; Fri, 12 Feb 2016 16:32:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5947F200E0 for ; Fri, 12 Feb 2016 16:31:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A4C946EAFD; Fri, 12 Feb 2016 08:31:54 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 561D36EAFB for ; Fri, 12 Feb 2016 08:31:52 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 12 Feb 2016 08:31:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,436,1449561600"; d="scan'208";a="901608995" Received: from linux.intel.com ([10.23.219.25]) by fmsmga001.fm.intel.com with ESMTP; 12 Feb 2016 08:31:51 -0800 Received: from beast.fi.intel.com (unknown [10.237.72.70]) by linux.intel.com (Postfix) with ESMTP id 90DAA6A4002; Fri, 12 Feb 2016 09:19:42 -0800 (PST) From: Martin Peres To: intel-gfx@lists.freedesktop.org Date: Fri, 12 Feb 2016 18:31:28 +0200 Message-Id: <1455294689-29249-7-git-send-email-martin.peres@linux.intel.com> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1455294689-29249-1-git-send-email-martin.peres@linux.intel.com> References: <1455294689-29249-1-git-send-email-martin.peres@linux.intel.com> Subject: [Intel-gfx] [PATCH 6/7] sna_video_sprite: add asserts to catch invalid pipe# 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-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Caught by Klockwork. This will be enough to catch those issues during bringup. Signed-off-by: Martin Peres Reviewed-by: Chris Wilson --- src/sna/sna_video_sprite.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c index 9e85049..ae08ef7 100644 --- a/src/sna/sna_video_sprite.c +++ b/src/sna/sna_video_sprite.c @@ -86,6 +86,7 @@ static int sna_video_sprite_stop(ddStopVideo_ARGS) int pipe; pipe = sna_crtc_pipe(crtc); + assert(pipe < ARRAY_SIZE(video->bo)); if (video->bo[pipe] == NULL) continue; @@ -260,6 +261,7 @@ sna_video_sprite_show(struct sna *sna, video->color_key_changed &= ~(1 << pipe); } + assert(pipe < ARRAY_SIZE(video->bo)); if (video->bo[pipe] == frame->bo) return true; @@ -415,6 +417,7 @@ static int sna_video_sprite_put_image(ddPutImage_ARGS) RegionIntersect(®, ®, &clip); if (RegionNil(®)) { off: + assert(pipe < ARRAY_SIZE(video->bo)); if (video->bo[pipe]) { struct local_mode_set_plane s; memset(&s, 0, sizeof(s));