All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Starkey <brian.starkey@arm.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t 3/5] lib/igt_kms: Fix possible out-of-bounds access
Date: Fri, 17 Feb 2017 17:54:28 +0000	[thread overview]
Message-ID: <1487354070-14487-3-git-send-email-brian.starkey@arm.com> (raw)
In-Reply-To: <1487354070-14487-1-git-send-email-brian.starkey@arm.com>

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 <brian.starkey@arm.com>
---
 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) {
 			/*
-- 
1.7.9.5

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

  parent reply	other threads:[~2017-02-17 17:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17 17:54 [PATCH i-g-t 1/5] lib/igt_kms: Fix drm_plane leak Brian Starkey
2017-02-17 17:54 ` [PATCH i-g-t 2/5] lib/igt_kms: Neaten up pipe->planes[] assignment Brian Starkey
2017-02-19 20:41   ` Robert Foss
2017-02-20 10:17     ` Brian Starkey
2017-02-17 17:54 ` Brian Starkey [this message]
2017-02-19 20:42   ` [PATCH i-g-t 3/5] lib/igt_kms: Fix possible out-of-bounds access Robert Foss
2017-02-17 17:54 ` [PATCH i-g-t 4/5] lib/igt_kms: Fix memory corruption when there's no cursor plane Brian Starkey
2017-02-19 20:43   ` Robert Foss
2017-02-17 17:54 ` [PATCH i-g-t 5/5] lib/igt_kms: Remove redundant cursor code Brian Starkey
2017-02-19 20:45   ` Robert Foss
2017-02-19 20:39 ` [PATCH i-g-t 1/5] lib/igt_kms: Fix drm_plane leak Robert Foss
2017-02-20 10:16   ` Brian Starkey

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=1487354070-14487-3-git-send-email-brian.starkey@arm.com \
    --to=brian.starkey@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.