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 1/2] lib/igt_chamelium: check drmModeGetConnector() return in wait_for_connected_state()
Date: Tue, 28 May 2024 10:58:54 +0300	[thread overview]
Message-ID: <20240528075855.463729-2-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 wait_for_connected_state(), so fix that.

Cc: Mark Yacoub <markyacoub@chromium.org>
Cc: Manasi Navare <navaremanasi@chromium.org>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 lib/igt_chamelium.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index 016d5356630c..620fbbf7d94f 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -524,6 +524,11 @@ static bool wait_for_connected_state(int drm_fd,
 			drmModeConnector *connector =
 				drmModeGetConnector(drm_fd, connectors[i]);
 
+			if (!connector) {
+				connected = false;
+				break;
+			}
+
 			connected = connector->connection == DRM_MODE_CONNECTED;
 
 			drmModeFreeConnector(connector);
-- 
2.39.2


  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 ` Luca Coelho [this message]
2024-05-29 16:06   ` [PATCH i-g-t v2 1/2] lib/igt_chamelium: check drmModeGetConnector() return in wait_for_connected_state() 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 ` [PATCH i-g-t v2 2/2] tests/intel: check drmModeGetConnector() return in i915_pm_rpm Luca Coelho
2024-05-29 16:37   ` 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-2-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