Tvrtko Ursulin <[email protected]> writes:

Hello Tvrtko,

> Currently the user can write anything into the drm.panic_screen modparam,
> either at runtime via sysfs, or as a kernel boot time argument. Invalid
> strings will be silently accepted and ignored at use time by defaulting to
> the 'user' panic mode.
>
> Let instead add some validation in order to have immediate feedback when
> something has been mistyped, or not compiled in.
>
> For example during kernel boot:
>
>  Booting kernel: `bsod' invalid for parameter `drm.panic_screen'
>
> Or at runtime:
>
>  # echo -n bsod > /sys/module/drm/parameters/panic_screen
>  -bash: echo: write error: Invalid argument
>
> Change of behavior is that when invalid mode is attempted to be
> configured, currently the code will default to the 'user' mode, while with
> this change the code will ignore it, and default to the mode set at kernel
> build time via CONFIG_DRM_PANIC_SCREEN.
>
> While at it lets also fix the module parameter description to include all
> compiled in modes.
>
> Signed-off-by: Tvrtko Ursulin <[email protected]>
> Cc: Jocelyn Falempe <[email protected]>
> Cc: Javier Martinez Canillas <[email protected]>
> ---
>  drivers/gpu/drm/drm_panic.c | 77 ++++++++++++++++++++++++++++++-------
>  1 file changed, 63 insertions(+), 14 deletions(-)
>

I agree that the behaviour is better after your change. The code looks
good to me.

Reviewed-by: Javier Martinez Canillas <[email protected]>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat

Reply via email to