Skip to content

Commit 88ca100

Browse files
陈学兵tsbogend
authored andcommitted
mips: setup: use strscpy to replace strlcpy
The strlcpy should not be used because it doesn't limit the source length. Preferred is strscpy. Signed-off-by: XueBing Chen <chenxuebing@jari.cn> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 07bdec3 commit 88ca100

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

arch/mips/kernel/setup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ static void __init bootcmdline_init(void)
554554
* unmodified.
555555
*/
556556
if (IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) {
557-
strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
557+
strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
558558
return;
559559
}
560560

@@ -566,7 +566,7 @@ static void __init bootcmdline_init(void)
566566
* boot_command_line to undo anything early_init_dt_scan_chosen() did.
567567
*/
568568
if (IS_ENABLED(CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND))
569-
strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
569+
strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
570570
else
571571
boot_command_line[0] = 0;
572572

@@ -628,7 +628,7 @@ static void __init arch_mem_init(char **cmdline_p)
628628
memblock_set_bottom_up(true);
629629

630630
bootcmdline_init();
631-
strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
631+
strscpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
632632
*cmdline_p = command_line;
633633

634634
parse_early_param();

0 commit comments

Comments
 (0)