[Intel-gfx] [PATCH i-g-t 2/3] lib/igt_sysfs: igt_sysfs_path only works for master nodes
Tvrtko Ursulin
tursulin at ursulin.net
Tue Nov 28 18:09:56 UTC 2017
From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
DRM code defines the minor range for master nodes as 0-63, so express that
explicitly near the top of the function.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
lib/igt_sysfs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index dd057dc04947..f0fef8d434ef 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -105,6 +105,10 @@ char *igt_sysfs_path(int device, char *path, int pathlen, int *idx)
if (device < 0 || fstat(device, &st) || !S_ISCHR(st.st_mode))
return NULL;
+ /* Only support master nodes. */
+ if (minor(st.st_rdev) >= 64)
+ return NULL;
+
for (int n = 0; n < 16; n++) {
int len = snprintf(path, pathlen, "/sys/class/drm/card%d", n);
int ret, maj, min;
--
2.14.1
More information about the Intel-gfx
mailing list