Commit 7365df19 authored by Xu Panda's avatar Xu Panda Committed by Petr Mladek
Browse files

printk: use strscpy() to instead of strlcpy()



The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL terminated strings.

Signed-off-by: default avatarXu Panda <xu.panda@zte.com.cn>
Signed-off-by: default avatarYang Yang <yang.yang29@zte.com>
Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/202211301601416229001@zte.com.cn
parent 7b0592a2
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -2391,7 +2391,7 @@ static int __add_preferred_console(char *name, int idx, char *options,
		return -E2BIG;
		return -E2BIG;
	if (!brl_options)
	if (!brl_options)
		preferred_console = i;
		preferred_console = i;
	strlcpy(c->name, name, sizeof(c->name));
	strscpy(c->name, name, sizeof(c->name));
	c->options = options;
	c->options = options;
	set_user_specified(c, user_specified);
	set_user_specified(c, user_specified);
	braille_set_options(c, brl_options);
	braille_set_options(c, brl_options);