Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luciano.coelho@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: kamil.konieczny@linux.intel.com
Subject: [PATCH i-g-t v2 2/2] tests/intel: check drmModeGetConnector() return in i915_pm_rpm
Date: Tue, 28 May 2024 10:58:55 +0300	[thread overview]
Message-ID: <20240528075855.463729-3-luciano.coelho@intel.com> (raw)
In-Reply-To: <20240528075855.463729-1-luciano.coelho@intel.com>

The drmModeGetConnector() function can return NULL in some cases, so
we need to check the return value before accessing it.  This is not
being checked in init_mode_set_data(), so fix that.

Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10911
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 tests/intel/i915_pm_rpm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/intel/i915_pm_rpm.c b/tests/intel/i915_pm_rpm.c
index 0ea5fbd8afd9..3b4034f24a57 100644
--- a/tests/intel/i915_pm_rpm.c
+++ b/tests/intel/i915_pm_rpm.c
@@ -515,6 +515,12 @@ static void init_mode_set_data(struct mode_set_data *data)
 			data->connectors[i] =
 				drmModeGetConnector(drm_fd,
 						    data->res->connectors[i]);
+			if (!data->connectors[i]) {
+				igt_debug("Could not read connector %u\n",
+					  data->res->connectors[i]);
+				continue;
+			}
+
 			data->edids[i] = get_connector_edid(data->connectors[i], i);
 		}
 
-- 
2.39.2


  parent reply	other threads:[~2024-05-28  7:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-28  7:58 [PATCH i-g-t v2 0/2] check drmModeGetConnector() return value in some missing places Luca Coelho
2024-05-28  7:58 ` [PATCH i-g-t v2 1/2] lib/igt_chamelium: check drmModeGetConnector() return in wait_for_connected_state() Luca Coelho
2024-05-29 16:06   ` Kamil Konieczny
2024-05-29 21:13     ` Luca Coelho
2024-06-07 14:38       ` Kamil Konieczny
2024-06-12 13:55         ` Luca Coelho
2024-05-28  7:58 ` Luca Coelho [this message]
2024-05-29 16:37   ` [PATCH i-g-t v2 2/2] tests/intel: check drmModeGetConnector() return in i915_pm_rpm Kamil Konieczny
2024-05-29 21:45     ` Luca Coelho
2024-06-07 14:39       ` Kamil Konieczny
2024-06-12 13:57         ` Luca Coelho
2024-05-28 18:25 ` ✓ CI.xeBAT: success for check drmModeGetConnector() return value in some missing places (rev3) Patchwork
2024-05-28 18:33 ` ✓ Fi.CI.BAT: " Patchwork
2024-05-28 19:38 ` ✓ CI.xeFULL: " Patchwork
2024-05-29 11:05 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-05-29 11:50   ` Luca Coelho
2024-05-30  8:57     ` Illipilli, TejasreeX
2024-05-30  7:49 ` ✓ Fi.CI.IGT: success " 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=20240528075855.463729-3-luciano.coelho@intel.com \
    --to=luciano.coelho@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.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