[igt-dev] [PATCH i-g-t] tests/kms_plane_scaling: Fix out-of-bound array access

Swati Sharma swati2.sharma at intel.com
Thu Mar 16 16:13:53 UTC 2023


With this fix we are solving 2 issues. Firstly, the
planes_scaling_combo() tests were leaving one scaler assigned
after running sub-test with two consecutive planes because
one scaler was getting reused in the next run.

Secondly, when k == n_planes - 1, we were trying to access
planes[n_planes], which led to array out of bounds error.

Suggested-by: Luca Coelho <luciano.coelho at intel.com>
Suggested-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Reported-by: Luca Coelho <luciano.coelho at intel.com>
Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
---
 tests/kms_plane_scaling.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 3a6904afb..3898446ed 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -744,7 +744,7 @@ test_planes_scaling_combo(data_t *d, int w1, int h1, int w2, int h2,
 		igt_assert(0);
 	}
 
-	for (int k = 0; k < display->pipes[pipe].n_planes; k++) {
+	for (int k = 0; k < display->pipes[pipe].n_planes; k += 2) {
 		igt_plane_t *p1, *p2;
 
 		p1 = &display->pipes[pipe].planes[k];
-- 
2.25.1



More information about the igt-dev mailing list