From: Tvrtko Ursulin <[email protected]>

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 <[email protected]>
---
 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to