All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>,
	dri-devel@lists.freedesktop.org
Cc: kernel-dev@igalia.com, Fei Yu <fei.yu@intel.com>
Subject: Re: [PATCH 1/3] drm/syncobj: Use vmemdup_array_user in drm_syncobj_array_find
Date: Tue, 17 Nov 2026 14:23:18 +0100	[thread overview]
Message-ID: <58bcfc9f-bb64-47b6-8cec-e774abb4ca86@amd.com> (raw)
In-Reply-To: <20261117103916.9101-2-tvrtko.ursulin@igalia.com>

On 11/17/26 11:39, Tvrtko Ursulin wrote:
> Using a helper shrinks the code and separating the user and kernel slabs
> is more secure.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Cc: Fei Yu <fei.yu@intel.com>
> Cc: Christian König <christian.koenig@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>  drivers/gpu/drm/drm_syncobj.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index 6cc654641183..663d6cb8dbf8 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -1252,15 +1252,10 @@ static int drm_syncobj_array_find(struct drm_file *file_private,
>  	if (count_handles > DRM_SYNCOBJ_MAX_HANDLES)
>  		return -EINVAL;
>  
> -	handles = kvmalloc_objs(*handles, count_handles);
> -	if (handles == NULL)
> -		return -ENOMEM;
> -
> -	if (copy_from_user(handles, user_handles,
> -			   sizeof(uint32_t) * count_handles)) {
> -		ret = -EFAULT;
> -		goto err_free_handles;
> -	}
> +	handles = vmemdup_array_user(user_handles, count_handles,
> +				     sizeof(*handles));
> +	if (IS_ERR(handles))
> +		return PTR_ERR(handles);
>  
>  	syncobjs = kvmalloc_objs(*syncobjs, count_handles);
>  	if (syncobjs == NULL) {


  parent reply	other threads:[~2026-11-17 13:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 10:39 [PATCH 0/3] drm/syncobj: Allocation avoiding fast path Tvrtko Ursulin
2026-11-17 10:39 ` [PATCH 1/3] drm/syncobj: Use vmemdup_array_user in drm_syncobj_array_find Tvrtko Ursulin
2026-11-17 12:57   ` Maíra Canal
2026-11-17 13:23   ` Christian König [this message]
2026-11-17 10:39 ` [PATCH 2/3] drm/syncobj: Add a fast path to drm_syncobj_array_wait_timeout Tvrtko Ursulin
2026-11-18  8:06   ` Yu, Fei
2026-11-17 10:39 ` [PATCH 3/3] drm/syncobj: Add a fast path to drm_syncobj_array_find Tvrtko Ursulin
2026-11-18  8:06   ` Yu, Fei
2026-11-18  8:06 ` [PATCH 0/3] drm/syncobj: Allocation avoiding fast path Yu, Fei
  -- strict thread matches above, loose matches on Subject: below --
2025-11-06 13:26 [PATCH 0/3] DRM syncobj wait " Tvrtko Ursulin
2025-11-06 13:26 ` [PATCH 1/3] drm/syncobj: Use vmemdup_array_user in drm_syncobj_array_find Tvrtko Ursulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58bcfc9f-bb64-47b6-8cec-e774abb4ca86@amd.com \
    --to=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fei.yu@intel.com \
    --cc=kernel-dev@igalia.com \
    --cc=tvrtko.ursulin@igalia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.