From: Peter Senna Tschudin <peter.senna@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Peter Senna Tschudin <peter.senna@linux.intel.com>
Subject: [PATCH i-g-t 3/3] lib/igt_facts: Fix potential NULL pointer dereference
Date: Fri, 25 Apr 2025 11:49:04 +0200 [thread overview]
Message-ID: <20250425094904.221857-3-peter.senna@linux.intel.com> (raw)
In-Reply-To: <20250425094904.221857-1-peter.senna@linux.intel.com>
If both udev_device_get_sysattr_value and udev_device_get_sysname fail,
pci_addr will remain NULL, which could lead to issues when using it
later in asprintf. Ignore cards when pci_addr cannot be extracted.
Signed-off-by: Peter Senna Tschudin <peter.senna@linux.intel.com>
---
lib/igt_facts.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/igt_facts.c b/lib/igt_facts.c
index d38be0726..47a2c98a5 100644
--- a/lib/igt_facts.c
+++ b/lib/igt_facts.c
@@ -537,6 +537,10 @@ static void igt_facts_scan_pci_drm_cards(const char *last_test)
"address");
if (!pci_addr)
pci_addr = udev_device_get_sysname(pci_dev);
+ if (!pci_addr) {
+ udev_device_unref(drm_dev);
+ continue;
+ }
} else {
/* Some GPUs are platform devices. Ignore them. */
pci_addr = NULL;
--
2.43.0
next prev parent reply other threads:[~2025-04-25 9:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-25 9:49 [PATCH i-g-t 1/3] lib/igt_facts: Remove NULL and bool comparisions Peter Senna Tschudin
2025-04-25 9:49 ` [PATCH i-g-t 2/3] lib/igt_facts: Remove unnecessary extern from header Peter Senna Tschudin
2025-04-25 13:17 ` Kamil Konieczny
2025-04-25 9:49 ` Peter Senna Tschudin [this message]
2025-04-25 13:20 ` [PATCH i-g-t 3/3] lib/igt_facts: Fix potential NULL pointer dereference Kamil Konieczny
2025-04-25 12:08 ` ✓ Xe.CI.BAT: success for series starting with [i-g-t,1/3] lib/igt_facts: Remove NULL and bool comparisions Patchwork
2025-04-25 13:17 ` [PATCH i-g-t 1/3] " Kamil Konieczny
2025-04-25 18:43 ` ✓ i915.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
2025-04-26 0:07 ` ✗ i915.CI.Full: failure " Patchwork
2025-04-26 8:05 ` Peter Senna Tschudin
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=20250425094904.221857-3-peter.senna@linux.intel.com \
--to=peter.senna@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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