From 545a4f89cad5bd349522d17558b3a4208648e20e Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Thu, 12 Oct 2023 09:42:56 +0300 Subject: printk: Check valid console index for preferred console Let's check for valid console index values for preferred console to avoid bogus console index numbers from kernel command line. Let's also return an error for negative index numbers for the preferred console. Unlike for device drivers, a negative index is not valid for the preferred console. Let's also constify idx while at it. Signed-off-by: Tony Lindgren Link: https://lore.kernel.org/r/20231012064300.50221-1-tony@atomide.com Signed-off-by: Greg Kroah-Hartman --- include/linux/console.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/linux/console.h') diff --git a/include/linux/console.h b/include/linux/console.h index 5ff6f11c47b1..1be13c9695e0 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -347,7 +347,7 @@ enum con_flush_mode { CONSOLE_REPLAY_ALL, }; -extern int add_preferred_console(char *name, int idx, char *options); +extern int add_preferred_console(char *name, const short idx, char *options); extern void console_force_preferred_locked(struct console *con); extern void register_console(struct console *); extern int unregister_console(struct console *); -- cgit v1.2.3