[PATCH i-g-t 2/3] lib/igt_sysfs: igt_sysfs_path only works for master nodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>

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@xxxxxxxxx>
---
 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

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux