[PATCH i-g-t 3/3] lib/igt_facts: Fix potential NULL pointer dereference
Peter Senna Tschudin
peter.senna at linux.intel.com
Fri Apr 25 09:49:04 UTC 2025
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 at 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
More information about the igt-dev
mailing list