Re: [PATCH] printk: Check valid console index for preferred console
From: Tony Lindgren
Date: Wed Oct 11 2023 - 03:34:13 EST
* Tony Lindgren <tony@xxxxxxxxxxx> [700101 02:00]:
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -2410,6 +2410,10 @@ static int __add_preferred_console(char *name, int idx, char *options,
> struct console_cmdline *c;
> int i;
>
> + /* See struct console */
> + if (idx > SHRT_MAX)
> + return -EINVAL;
> +
We can just use const short idx for preferred console and return an error
for negative values for preferred console. I'll send out v2 patch.
Regards,
Tony