On 9/30/26 11:38, Jesse Zhang wrote:
> mes_userq_mqd_create() returns -ENOMEM when copying the user MQD fails,
> even though memdup_user() returns -EFAULT for a bad pointer or -EINTR
> when interrupted by a signal. Return PTR_ERR() instead.
> 
> While at it drop the error messages. Neither case is a driver error and
> userspace shouldn't be able to spam the log with invalid IOCTL
> parameters.
> 
> v2: drop the error messages (Christian)
> 
> Fixes: 2c695d7c0720 ("drm/amdgpu: enable compute/gfx usermode queue")
> Fixes: 543b61453774 ("drm/amdgpu: enable SDMA usermode queues")
> Signed-off-by: Jesse Zhang <[email protected]>

Reviewed-by: Christian König <[email protected]>

> ---
>  drivers/gpu/drm/amd/amdgpu/mes_userqueue.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c 
> b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> index e6c167a39d44..1b76c10d1ac2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
> @@ -407,8 +407,7 @@ static int mes_userq_mqd_create(struct 
> amdgpu_usermode_queue *queue,
>  
>               compute_mqd = memdup_user(u64_to_user_ptr(mqd_user->mqd), 
> mqd_user->mqd_size);
>               if (IS_ERR(compute_mqd)) {
> -                     DRM_ERROR("Failed to read user MQD\n");
> -                     r = -ENOMEM;
> +                     r = PTR_ERR(compute_mqd);
>                       goto free_mqd;
>               }
>  
> @@ -452,8 +451,7 @@ static int mes_userq_mqd_create(struct 
> amdgpu_usermode_queue *queue,
>  
>               mqd_gfx_v11 = memdup_user(u64_to_user_ptr(mqd_user->mqd), 
> mqd_user->mqd_size);
>               if (IS_ERR(mqd_gfx_v11)) {
> -                     DRM_ERROR("Failed to read user MQD\n");
> -                     r = -ENOMEM;
> +                     r = PTR_ERR(mqd_gfx_v11);
>                       goto free_mqd;
>               }
>  
> @@ -497,8 +495,7 @@ static int mes_userq_mqd_create(struct 
> amdgpu_usermode_queue *queue,
>  
>               mqd_sdma_v11 = memdup_user(u64_to_user_ptr(mqd_user->mqd), 
> mqd_user->mqd_size);
>               if (IS_ERR(mqd_sdma_v11)) {
> -                     DRM_ERROR("Failed to read sdma user MQD\n");
> -                     r = -ENOMEM;
> +                     r = PTR_ERR(mqd_sdma_v11);
>                       goto free_mqd;
>               }
>  

Reply via email to