public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mohammed Thasleem <mohammed.thasleem@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: petri.latvala@intel.com
Subject: [igt-dev] [PATCH i-g-t v3] lib/igt_kms: Fixed the usage of dereferencing of null pointer
Date: Fri, 20 Jan 2023 19:05:40 +0530	[thread overview]
Message-ID: <20230120133540.58340-1-mohammed.thasleem@intel.com> (raw)
In-Reply-To: <20230120123639.57140-1-mohammed.thasleem@intel.com>

Fixed the usage of dereferencing of null pointer to avoid crash.

v2: Removed igt_require and return false if proplist empty. (Kamil)

v3: Corrected commit msg and description. (Kamil)

Signed-off-by: Mohammed Thasleem <mohammed.thasleem@intel.com>
---
 lib/igt_kms.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index b4a98ae1..6a0c5ac2 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1941,6 +1941,9 @@ kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t object_type,
 	int i;
 
 	proplist = drmModeObjectGetProperties(drm_fd, object_id, object_type);
+	if (!proplist)
+		return false;
+
 	for (i = 0; i < proplist->count_props; i++) {
 		_prop = drmModeGetProperty(drm_fd, proplist->props[i]);
 		if (!_prop)
-- 
2.25.1

  reply	other threads:[~2023-01-20 13:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-20 12:36 [igt-dev] [PATCH i-g-t v2] lib/igt_kms: Fixed the usage of Dereferencing of null pointer Mohammed Thasleem
2023-01-20 13:35 ` Mohammed Thasleem [this message]
2023-01-23 10:40   ` [igt-dev] [PATCH i-g-t v3] lib/igt_kms: Fixed the usage of dereferencing " Kamil Konieczny
2023-01-20 13:45 ` [igt-dev] ✗ GitLab.Pipeline: warning for lib/igt_kms: Fixed the usage of Dereferencing of null pointer (rev3) Patchwork
2023-01-20 14:15 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-01-20 14:20 ` [igt-dev] ✗ GitLab.Pipeline: warning for lib/igt_kms: Fixed the usage of Dereferencing of null pointer (rev4) Patchwork
2023-01-20 14:30 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-01-20 17:29 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_kms: Fixed the usage of Dereferencing of null pointer (rev5) Patchwork
2023-01-21 18:12 ` [igt-dev] ✓ Fi.CI.IGT: success for lib/igt_kms: Fixed the usage of Dereferencing of null pointer (rev3) Patchwork
2023-01-21 18:17 ` [igt-dev] ✓ Fi.CI.IGT: success for lib/igt_kms: Fixed the usage of Dereferencing of null pointer (rev4) Patchwork
2023-01-21 19:52 ` [igt-dev] ✓ Fi.CI.IGT: success for lib/igt_kms: Fixed the usage of Dereferencing of null pointer (rev5) 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=20230120133540.58340-1-mohammed.thasleem@intel.com \
    --to=mohammed.thasleem@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@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