Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH] [i-g-t] tests/amdgpu/amd_hotplug: fix test crash signal sigsegv
@ 2023-05-04 14:22 Hersen Wu
  2023-05-04 15:13 ` Hamza Mahfooz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hersen Wu @ 2023-05-04 14:22 UTC (permalink / raw)
  To: igt-dev, rodrigo.siqueira, aurabindo.pillai, alex.hung,
	hamza.mahfooz
  Cc: Hersen Wu

MAX_PIPES is 6 within amd_hotplug. IGT_MAX_PIPES is changed from
6 to 8 by 'commit 3d3a7f1c041d ("lib: Fix igt_kms for drivers with
8 crtc's")'. amd_hotplug loop up to display->n_pipes = 8, this will
exceed range of array and cause crash.
fix this issue with loop using for_each_pipe.

Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
---
 tests/amdgpu/amd_hotplug.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/amdgpu/amd_hotplug.c b/tests/amdgpu/amd_hotplug.c
index 736040a2..c13bf49d 100644
--- a/tests/amdgpu/amd_hotplug.c
+++ b/tests/amdgpu/amd_hotplug.c
@@ -109,7 +109,7 @@ static void test_hotplug_basic(data_t *data, bool suspend)
 	test_init(data);
 
 	/* Setup all outputs */
-	for (i = 0; i < display->n_pipes; i++) {
+	for_each_pipe(&data->display, i) {
 		output = data->output[i];
 		if (!output || !igt_output_is_connected(output))
 			continue;
@@ -122,7 +122,7 @@ static void test_hotplug_basic(data_t *data, bool suspend)
 	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET, 0);
 
 	/* Collect reference CRCs */
-	for (i = 0; i < display->n_pipes; i++) {
+	for_each_pipe(&data->display, i) {
 		output = data->output[i];
 		if (!output || !igt_output_is_connected(output))
 			continue;
@@ -136,7 +136,7 @@ static void test_hotplug_basic(data_t *data, bool suspend)
 	}
 
 	/* Trigger hotplug and confirm reference image is the same. */
-	for (i = 0; i < display->n_pipes; i++) {
+	for_each_pipe(&data->display, i) {
 		output = data->output[i];
 		if (!output || !igt_output_is_connected(output))
 			continue;
-- 
2.25.1

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

end of thread, other threads:[~2023-05-05  4:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-04 14:22 [igt-dev] [PATCH] [i-g-t] tests/amdgpu/amd_hotplug: fix test crash signal sigsegv Hersen Wu
2023-05-04 15:13 ` Hamza Mahfooz
2023-05-04 16:46 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2023-05-05  4:58 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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