Skip to content

Commit

Permalink
Merge tag 'nios2-v5.4-rc1' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/lftan/nios2

Pull nios2 fix from Ley Foon Tan:
 "Make sure the command line buffer is NUL-terminated"

* tag 'nios2-v5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/lftan/nios2:
  nios2: force the string buffer NULL-terminated
  • Loading branch information
Linus Torvalds committed Sep 27, 2019
2 parents 8bbe0de + 91d99a7 commit 70570a6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/nios2/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,18 @@ asmlinkage void __init nios2_boot_init(unsigned r4, unsigned r5, unsigned r6,
dtb_passed = r6;

if (r7)
strncpy(cmdline_passed, (char *)r7, COMMAND_LINE_SIZE);
strlcpy(cmdline_passed, (char *)r7, COMMAND_LINE_SIZE);
}
#endif

early_init_devtree((void *)dtb_passed);

#ifndef CONFIG_CMDLINE_FORCE
if (cmdline_passed[0])
strncpy(boot_command_line, cmdline_passed, COMMAND_LINE_SIZE);
strlcpy(boot_command_line, cmdline_passed, COMMAND_LINE_SIZE);
#ifdef CONFIG_NIOS2_CMDLINE_IGNORE_DTB
else
strncpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
#endif
#endif

Expand Down

0 comments on commit 70570a6

Please sign in to comment.