Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hersen Wu <hersenxs.wu@amd.com>
To: <igt-dev@lists.freedesktop.org>, <rodrigo.siqueira@amd.com>,
	<aurabindo.pillai@amd.com>, <alex.hung@amd.com>,
	<hamza.mahfooz@amd.com>
Cc: Hersen Wu <hersenxs.wu@amd.com>
Subject: [igt-dev] [PATCH] [i-g-t] tests/amdgpu/amd_hotplug: fix test crash signal sigsegv
Date: Thu, 4 May 2023 10:22:51 -0400	[thread overview]
Message-ID: <20230504142251.34775-1-hersenxs.wu@amd.com> (raw)

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

             reply	other threads:[~2023-05-04 14:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04 14:22 Hersen Wu [this message]
2023-05-04 15:13 ` [igt-dev] [PATCH] [i-g-t] tests/amdgpu/amd_hotplug: fix test crash signal sigsegv 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230504142251.34775-1-hersenxs.wu@amd.com \
    --to=hersenxs.wu@amd.com \
    --cc=alex.hung@amd.com \
    --cc=aurabindo.pillai@amd.com \
    --cc=hamza.mahfooz@amd.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=rodrigo.siqueira@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox