[igt-dev] [PATCH i-g-t 1/2] lib/kms: Range check pipe before lookup

Chris Wilson chris at chris-wilson.co.uk
Thu Nov 19 09:43:17 UTC 2020


Make sure the lookup index is within the range of the table before
accessing.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/igt_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index e5d8e82c9..9175e50fe 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1902,7 +1902,7 @@ static void igt_fill_display_format_mod(igt_display_t *display);
  */
 void igt_require_pipe(igt_display_t *display, enum pipe pipe)
 {
-	igt_skip_on_f(!display->pipes[pipe].enabled,
+	igt_skip_on_f(pipe >= display->n_pipes || !display->pipes[pipe].enabled,
 			"Pipe %s does not exist or not enabled\n",
 			kmstest_pipe_name(pipe));
 }
-- 
2.29.2



More information about the igt-dev mailing list