From: Samuel Thibault Braille screen reader fixes: - console_cmdline's brl_options field is only required when braille console support is enabled. - Use strlcpy to copy the console name. - braille console support depends on VT support. Signed-off-by: Samuel Thibault Cc: Jiri Kosina Cc: Dmitry Torokhov Signed-off-by: Andrew Morton --- drivers/accessibility/Kconfig | 1 + kernel/printk.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff -puN drivers/accessibility/Kconfig~basic-braille-screen-reader-support-fixes drivers/accessibility/Kconfig --- a/drivers/accessibility/Kconfig~basic-braille-screen-reader-support-fixes +++ a/drivers/accessibility/Kconfig @@ -8,6 +8,7 @@ menuconfig ACCESSIBILITY if ACCESSIBILITY config A11Y_BRAILLE_CONSOLE bool "Console on braille device" + depends on VT depends on SERIAL_CORE_CONSOLE ---help--- Enables console output on a braille device connected to a 8250 diff -puN kernel/printk.c~basic-braille-screen-reader-support-fixes kernel/printk.c --- a/kernel/printk.c~basic-braille-screen-reader-support-fixes +++ a/kernel/printk.c @@ -111,7 +111,9 @@ struct console_cmdline char name[8]; /* Name of the driver */ int index; /* Minor dev. to use */ char *options; /* Options for the driver */ +#ifdef CONFIG_A11Y_BRAILLE_CONSOLE char *brl_options; /* Options for braille driver */ +#endif }; #define MAX_CMDLINECONSOLES 8 @@ -818,10 +820,11 @@ static int __add_preferred_console(char if (!brl_options) selected_console = i; c = &console_cmdline[i]; - memcpy(c->name, name, sizeof(c->name)); - c->name[sizeof(c->name) - 1] = 0; + strlcpy(c->name, name, sizeof(c->name)); c->options = options; +#ifdef CONFIG_A11Y_BRAILLE_CONSOLE c->brl_options = brl_options; +#endif c->index = idx; return 0; } _