Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] cleanup: mixing goto and scope-based cleanup in 
drm_syncobj_eventfd_ioctl
--

commit ff6fd047e86cd28041b0ce12099546c46df110b2
Author: Bence Csokas <[email protected]>

drm/syncobj: Use scope-based cleanup for eventfd_ctx

This patch converts the eventfd context in drm_syncobj_eventfd_ioctl() to
use scope-based cleanup now that eventfd supports it.

> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index c23a5de27effa..efc4e8af220c8 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -1462,9 +1462,9 @@ int
>  drm_syncobj_eventfd_ioctl(struct drm_device *dev, void *data,
>                         struct drm_file *file_private)
>  {
> +     struct eventfd_ctx *ev_fd_ctx __free(eventfd) = NULL;
>       struct drm_syncobj_eventfd *args = data;
>       struct drm_syncobj *syncobj;

[ ... ]

> @@ -1490,10 +1490,10 @@ drm_syncobj_eventfd_ioctl(struct drm_device *dev, 
> void *data,
>       entry = kzalloc_obj(*entry);
>       if (!entry) {
>               ret = -ENOMEM;
> -             goto err_kzalloc;
> +             goto err_fdget;

[Severity: Medium]
Does this mix goto-based error handling and scope-based cleanup within
drm_syncobj_eventfd_ioctl()?

According to include/linux/cleanup.h, the expectation is that usage of
goto and cleanup helpers is never mixed in the same function. All resources
that need cleanup should either be converted to scope-based cleanup, or
none of them.

Leaving the err_fdget label to manually call drm_syncobj_put(syncobj)
while using __free(eventfd) for ev_fd_ctx can lead to confusing resource
ownership and break the expected LIFO teardown ordering.

Could syncobj be converted to use scope-based cleanup as well?

>       }
>       entry->syncobj = syncobj;
> -     entry->ev_fd_ctx = ev_fd_ctx;
> +     entry->ev_fd_ctx = no_free_ptr(ev_fd_ctx);
>       entry->point = args->point;
>       entry->flags = args->flags;

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to