On Tue, Mar 3, 2026 at 5:40 PM Maarten Lankhorst
<[email protected]> wrote:
>
> There is precedence in the ioctl, the pad member is checked against zero for 
> the same reason.

I don't believe that this is comparable. Developers of code developed
against an older kernel could look at the kernel and see that the pad
field was checked against zero. They could not see the same for fields
that didn't exist at the time.

> The check was there because it is invalid to pass when 
> IMPORT/EXPORT_SYNC_FILE was not set.
>
> This is what I would recommend instead:
>
> [...]
>
> +       if (!(args->flags & DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_TIMELINE) &&
> +           !(args->flags & DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE) 
> &&
> +             args->point)
> +               return -EINVAL;

Should it not be

+       if ((!(args->flags & DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_TIMELINE) ||
+           !(args->flags & DRM_SYNCOBJ_HANDLE_TO_FD_FLAGS_EXPORT_SYNC_FILE)) &&
+             args->point)
+               return -EINVAL;

Reply via email to