Skip to content

Commit 7365df1

Browse files
Xu Pandapmladek
authored andcommitted
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: Xu Panda <[email protected]> Signed-off-by: Yang Yang <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 7b0592a commit 7365df1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/printk/printk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2391,7 +2391,7 @@ static int __add_preferred_console(char *name, int idx, char *options,
23912391
return -E2BIG;
23922392
if (!brl_options)
23932393
preferred_console = i;
2394-
strlcpy(c->name, name, sizeof(c->name));
2394+
strscpy(c->name, name, sizeof(c->name));
23952395
c->options = options;
23962396
set_user_specified(c, user_specified);
23972397
braille_set_options(c, brl_options);

0 commit comments

Comments
 (0)