Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] tests/kms_plane_scaling: Fix out-of-bound array access
@ 2023-03-16 14:50 Swati Sharma
  0 siblings, 0 replies; 5+ messages in thread
From: Swati Sharma @ 2023-03-16 14:50 UTC (permalink / raw)
  To: igt-dev; +Cc: Luca Coelho

When k == n_planes - 1, we will try to access planes[n_planes],
which is out of bounds. Fix this.

Reported-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Swati Sharma <swati2.sharma@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..8d78752cc 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 - 1; k++) {
 		igt_plane_t *p1, *p2;
 
 		p1 = &display->pipes[pipe].planes[k];
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [igt-dev] [PATCH i-g-t] tests/kms_plane_scaling: Fix out-of-bound array access
@ 2023-03-16 16:13 Swati Sharma
  2023-03-17  7:35 ` Coelho, Luciano
  2023-03-19 20:13 ` Juha-Pekka Heikkilä
  0 siblings, 2 replies; 5+ messages in thread
From: Swati Sharma @ 2023-03-16 16:13 UTC (permalink / raw)
  To: igt-dev; +Cc: Luca Coelho

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@intel.com>
Suggested-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reported-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Swati Sharma <swati2.sharma@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

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [igt-dev] [PATCH i-g-t] tests/kms_plane_scaling: Fix out-of-bound array access
@ 2023-03-16 14:34 Swati Sharma
  0 siblings, 0 replies; 5+ messages in thread
From: Swati Sharma @ 2023-03-16 14:34 UTC (permalink / raw)
  To: igt-dev; +Cc: Coelho, Luciano

When k == n_planes - 1, we will try to access planes[n_planes],
which is out of bounds. Fix this.

Reported-by: Coelho, Luciano <luciano.coelho@intel.com>
Signed-off-by: Swati Sharma <swati2.sharma@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 3a6904af..8d78752c 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 - 1; k++) {
 		igt_plane_t *p1, *p2;
 
 		p1 = &display->pipes[pipe].planes[k];
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-19 20:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-16 14:50 [igt-dev] [PATCH i-g-t] tests/kms_plane_scaling: Fix out-of-bound array access Swati Sharma
  -- strict thread matches above, loose matches on Subject: below --
2023-03-16 16:13 Swati Sharma
2023-03-17  7:35 ` Coelho, Luciano
2023-03-19 20:13 ` Juha-Pekka Heikkilä
2023-03-16 14:34 Swati Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox