intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Martin Peres <martin.peres@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 6/7] sna_video_sprite: add asserts to catch invalid pipe#
Date: Fri, 12 Feb 2016 18:31:28 +0200	[thread overview]
Message-ID: <1455294689-29249-7-git-send-email-martin.peres@linux.intel.com> (raw)
In-Reply-To: <1455294689-29249-1-git-send-email-martin.peres@linux.intel.com>

Caught by Klockwork. This will be enough to catch those issues during
bringup.

Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
---
 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(&reg, &reg, &clip);
 		if (RegionNil(&reg)) {
 off:
+			assert(pipe < ARRAY_SIZE(video->bo));
 			if (video->bo[pipe]) {
 				struct local_mode_set_plane s;
 				memset(&s, 0, sizeof(s));
-- 
2.7.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-02-12 16:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12 16:31 [PATCH DDX 0/7] Some issues found with Klockwork Martin Peres
2016-02-12 16:31 ` [PATCH 1/7] device: prevent a NULL pointer dereference in __intel_peek_fd Martin Peres
2016-02-12 16:40   ` Chris Wilson
2016-02-15 12:24   ` Dave Gordon
2016-02-15 13:40     ` Martin Peres
2016-02-15 13:47       ` Dave Gordon
2016-02-15 15:56         ` Martin Peres
2016-02-16  8:54           ` Dave Gordon
2016-02-16 11:09             ` Martin Peres
2016-02-15 13:43     ` David Weinehall
2016-02-15 14:08       ` Dave Gordon
2016-02-12 16:31 ` [PATCH 2/7] display: prevent a NULL pointer dereference in intel_set_scanout_pixmap Martin Peres
2016-02-12 17:34   ` Chris Wilson
2016-02-12 16:31 ` [PATCH 3/7] sna: check for NULL before dereferencing a pointer Martin Peres
2016-02-12 16:48   ` Chris Wilson
2016-02-12 16:31 ` [PATCH 4/7] sna: assert a pointer is non-NULL before dereferencing it Martin Peres
2016-02-12 16:42   ` Chris Wilson
2016-02-12 16:31 ` [PATCH 5/7] sna/cursor: add an assert on cursor->image Martin Peres
2016-02-12 16:47   ` Chris Wilson
2016-02-12 16:31 ` Martin Peres [this message]
2016-02-12 16:45   ` [PATCH 6/7] sna_video_sprite: add asserts to catch invalid pipe# Chris Wilson
2016-02-12 16:31 ` [PATCH 7/7] sna: add an assert in the lengthy sna_drawable_use_bo Martin Peres
2016-02-12 16:45   ` Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455294689-29249-7-git-send-email-martin.peres@linux.intel.com \
    --to=martin.peres@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).