summaryrefslogtreecommitdiff
path: root/include/linux/console.h
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2023-10-12 09:42:56 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-17 11:18:59 +0300
commit545a4f89cad5bd349522d17558b3a4208648e20e (patch)
treed4b4055f77c23696ead18417a1671a6b8d932251 /include/linux/console.h
parenta07b50d80ab621f4f18d429068a43cffec26691f (diff)
downloadlinux-545a4f89cad5bd349522d17558b3a4208648e20e.tar.xz
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 <tony@atomide.com> Link: https://lore.kernel.org/r/20231012064300.50221-1-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/console.h')
-rw-r--r--include/linux/console.h2
1 files changed, 1 insertions, 1 deletions
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 *);