From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: misc/syncobj: add new device Date: Mon, 18 May 2026 16:53:32 +1000 Message-ID: In-Reply-To: <20260516-jorth-syncobj-v1-12-88ede9d98a81@gmail.com> References: <20260516-jorth-syncobj-v1-0-88ede9d98a81@gmail.com> <20260516-jorth-syncobj-v1-12-88ede9d98a81@gmail.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review This is the main patch. Creates `/dev/syncobj` as a misc device with mode `0666`. **Concerns:** 1. **No `compat_ioctl` struct padding verification**: The structures look well-aligned (all fields are naturally aligned, no implicit padding), and `compat_ptr_ioctl` is used. This should be fine. 2. **ioctl number**: Using `0xCD` which overlaps with the dead reiserfs range. The patch adds `0xCD 00-0F` to `ioctl-number.rst` right after the `0xCD 01` dead entry. This should work but could be confusing. Consider choosing a less ambiguous range. 3. **`mode = 0666`**: World-readable/writable. This is intentional since syncobjs are meant to be available to unprivileged users, similar to `/dev/dri/renderD*`. Fine for the use case. 4. **Missing `SYNCOBJ_IOC_QUERY` direction**: The query ioctl writes results back to userspace (via `copy_to_user` in `drm_syncobj_query`) but is declared as `_IOW` not `_IOWR`: ```c #define SYNCOBJ_IOC_QUERY _IOW(SYNCOBJ_IOC_BASE, 4, struct syncobj_array_args) ``` Since the `points` field is a pointer to a user buffer (not the struct itself), this is technically acceptable (the struct itself is only read), but it's misleading. The same argument applies to `SYNCOBJ_IOC_SIGNAL` which also reads points from userspace through the pointer. 5. **No selftests**: A new UAPI should come with `tools/testing/selftests/` tests. 6. **`syncobj_ioctl_wait` returns `timeout` directly when negative**: `drm_syncobj_array_wait_timeout()` returns a negative `signed long` on error (e.g., `-ERESTARTSYS`). The code `if (timeout < 0) return timeout;` truncates `signed long` to `int` on 64-bit platforms. In practice the errno values fit in `int`, but this is technically a type narrowing. 7. **Module dependency on DRM**: The Kconfig has `depends on DRM` which is correct since it uses `drm_syncobj_*` functions. But if DRM is built as a module and this is also a module, the module loading order needs to be correct. `module_misc_device` handles init, but there's no explicit `MODULE_SOFTDEP` or similar. 8. **`syncobj_wait_args.pad` check**: Good -- the pad field is validated to be zero. However, `syncobj_sync_file_args` has no pad or flags field, meaning there's no reserved space for future extension of the export/import ioctls. Consider adding a `__u32 flags; __u32 pad;` to `syncobj_sync_file_args`. --- Generated by Claude Code Patch Reviewer