Skip to content

Commit 8a33d96

Browse files
XueBing ChenIngo Molnar
authored andcommitted
x86/setup: Use strscpy() to replace deprecated strlcpy()
strlcpy() is marked deprecated and should not be used, because it doesn't limit the source length. The preferred interface for when strlcpy()'s return value is not checked (truncation) is strscpy(). [ mingo: Tweaked the changelog ] Signed-off-by: XueBing Chen <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6f3f04c commit 8a33d96

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/x86/kernel/setup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -903,18 +903,18 @@ void __init setup_arch(char **cmdline_p)
903903

904904
#ifdef CONFIG_CMDLINE_BOOL
905905
#ifdef CONFIG_CMDLINE_OVERRIDE
906-
strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
906+
strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
907907
#else
908908
if (builtin_cmdline[0]) {
909909
/* append boot loader cmdline to builtin */
910910
strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
911911
strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
912-
strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
912+
strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
913913
}
914914
#endif
915915
#endif
916916

917-
strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
917+
strscpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
918918
*cmdline_p = command_line;
919919

920920
/*

0 commit comments

Comments
 (0)