lib/igt_kms: Fix passing invalid fd to openat(2).
PATCH 1/1 lib/igt_kms: Fix passing invalid fd to openat(2).
Introduced by 0e11befe442. openat(2) uses a relative path. Fix by passing the correct fd.
Signed-off-by Marius Vlad <[email protected]>
CC Chris Wilson <[email protected]>
--- lib/igt_kms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/igt_kms.c +2 -1
@@ -641,7 +641,8 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,return false; } -if (!igt_sysfs_set (drm_fd, path, value)) { +/* use the fd returned by igt_sysfs_open() */ +if (!igt_sysfs_set (dir, path, value)) {close (dir);return false; }
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 5 lines · Marius Vlad
Introduced by
0e11befe442. openat(2) uses a relative path. Fix by passing the correct fd.Signed-off-by Marius Vlad <[email protected]>CC Chris Wilson <[email protected]>
Yup, At one point it was using the drm_fd to search for the right sysfs every time,
Quoted 9 lines
--- lib/igt_kms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)lib/igt_kms.c +0
-0
lib/igt_kms.c bool kmstest_force_connector(int drm_fd, drmModeConnector *connector, · line 644
Quoted 5 lines
lib/igt_kms.c +1
-1@@ -641,7 +641,8 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,return false; } -if (!igt_sysfs_set (drm_fd, path, value)) { +/* use the fd returned by igt_sysfs_open() */
Just call it dir, don't tell people they can treat it as an fd.
lib/igt_kms.c bool kmstest_force_connector(int drm_fd, drmModeConnector *connector, · line 648
Quoted 4 lines
lib/igt_kms.c +1
-0+if (!igt_sysfs_set (dir, path, value)) {close (dir);return false; }
Preferrably without the comment,
Reviewed-by Chris Wilson <[email protected]>
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx