On 3/17/26 02:17, Jesse.Zhang wrote:
> amdgpu_sched_ioctl() currently uses WARN(1, ...) when userspace passes
> an out-of-range context priority value. WARN(1, ...) is unconditional
> and produces a full stack trace, which is disproportionate for a simple
> input validation failure -- the invalid value is already rejected with
> -EINVAL on the next line.
> 
> Replace WARN(1, ...) with DRM_ERROR() to log the invalid value at an
> appropriate level without generating a stack dump. The -EINVAL return
> to userspace is unchanged.
> 
> No functional change for well-formed userspace callers.
> 
> v2:
> - Reworked commit message to focus on appropriate log level for
>   parameter validation
> - Clarified that -EINVAL behavior is preserved
> 
> Signed-off-by: Jesse Zhang <[email protected]>
> Reviewed-by: Vitaly Prosyak <[email protected]>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
> index 341beec59537..4126e5026c20 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
> @@ -104,7 +104,7 @@ int amdgpu_sched_ioctl(struct drm_device *dev, void *data,
>       }
>  
>       if (!amdgpu_ctx_priority_is_valid(args->in.priority)) {
> -             WARN(1, "Invalid context priority %d\n", args->in.priority);
> +             DRM_ERROR("Invalid context priority %d\n", args->in.priority);

Please completely drop that warning. Invalid parameters should never clutter 
the system log.

Apart from that looks good to me.

Regards,
Christian

>               return -EINVAL;
>       }
>  

Reply via email to