[igt-dev] [PATCH] [i-g-t] tests/amdgpu/amd_hotplug: fix test crash signal sigsegv

Hersen Wu hersenxs.wu at amd.com
Thu May 4 14:22:51 UTC 2023


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 at 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



More information about the igt-dev mailing list