|
|
565c3d |
From 099489b7917da44de57f3214425ea9b4a8f36482 Mon Sep 17 00:00:00 2001
|
|
|
565c3d |
From: Keith Busch <keith.busch@intel.com>
|
|
|
565c3d |
Date: Wed, 10 Aug 2016 17:05:23 -0600
|
|
|
565c3d |
Subject: [PATCH] Ignore 32-bit domains
|
|
|
565c3d |
|
|
|
565c3d |
A pci "domain" need not be limited to the 16-bits. The Linux kernel
|
|
|
565c3d |
currently supports 32-bit domains which cause startx to segfault. Updating
|
|
|
565c3d |
libpciaccess to support 32-bit domains breaks the library's ABI, and
|
|
|
565c3d |
domains requiring 32-bits are not necessary for startx anyway, so this
|
|
|
565c3d |
patch ignores them.
|
|
|
565c3d |
|
|
|
565c3d |
Reported-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
|
|
|
565c3d |
Signed-off-by: Keith Busch <keith.busch@intel.com>
|
|
|
565c3d |
Reviewed-by: Eric Anholt <eric@anholt.net>
|
|
|
565c3d |
---
|
|
|
565c3d |
src/linux_sysfs.c | 14 ++++++++++++--
|
|
|
565c3d |
1 file changed, 12 insertions(+), 2 deletions(-)
|
|
|
565c3d |
|
|
|
565c3d |
diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c
|
|
|
565c3d |
index 6367b11..cd2713d 100644
|
|
|
565c3d |
--- a/src/linux_sysfs.c
|
|
|
565c3d |
+++ b/src/linux_sysfs.c
|
|
|
565c3d |
@@ -119,18 +119,28 @@ pci_system_linux_sysfs_create( void )
|
|
|
565c3d |
|
|
|
565c3d |
|
|
|
565c3d |
/**
|
|
|
565c3d |
- * Filter out the names "." and ".." from the scanned sysfs entries.
|
|
|
565c3d |
+ * Filter out the names "." and ".." from the scanned sysfs entries, and
|
|
|
565c3d |
+ * domains requiring 32-bits.
|
|
|
565c3d |
*
|
|
|
565c3d |
* \param d Directory entry being processed by \c scandir.
|
|
|
565c3d |
*
|
|
|
565c3d |
* \return
|
|
|
565c3d |
- * Zero if the entry name matches either "." or "..", non-zero otherwise.
|
|
|
565c3d |
+ * Zero if the entry name matches either "." or "..", or the domain requires
|
|
|
565c3d |
+ * 32 bits, non-zero otherwise.
|
|
|
565c3d |
*
|
|
|
565c3d |
* \sa scandir, populate_entries
|
|
|
565c3d |
*/
|
|
|
565c3d |
static int
|
|
|
565c3d |
scan_sys_pci_filter( const struct dirent * d )
|
|
|
565c3d |
{
|
|
|
565c3d |
+ if (d->d_name[0] != '.') {
|
|
|
565c3d |
+ unsigned dom = 0;
|
|
|
565c3d |
+
|
|
|
565c3d |
+ sscanf(d->d_name, "%x:", &dom;;
|
|
|
565c3d |
+ if (dom > USHRT_MAX)
|
|
|
565c3d |
+ return 0;
|
|
|
565c3d |
+ }
|
|
|
565c3d |
+
|
|
|
565c3d |
return !((strcmp( d->d_name, "." ) == 0)
|
|
|
565c3d |
|| (strcmp( d->d_name, ".." ) == 0));
|
|
|
565c3d |
}
|
|
|
565c3d |
--
|
|
|
565c3d |
2.5.5
|
|
|
565c3d |
|