Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
init: fix possible format string bug
Browse files Browse the repository at this point in the history
Use constant format string in case message changes.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Tetsuo Handa authored and torvalds committed Jan 24, 2014
1 parent 128e3f4 commit 499a458
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion init/initramfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ static int __init populate_rootfs(void)
{
char *err = unpack_to_rootfs(__initramfs_start, __initramfs_size);
if (err)
panic(err); /* Failed to decompress INTERNAL initramfs */
panic("%s", err); /* Failed to decompress INTERNAL initramfs */
if (initrd_start) {
#ifdef CONFIG_BLK_DEV_RAM
int fd;
Expand Down
7 changes: 4 additions & 3 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ static int __init unknown_bootoption(char *param, char *val, const char *unused)
unsigned int i;
for (i = 0; envp_init[i]; i++) {
if (i == MAX_INIT_ENVS) {
panic_later = "Too many boot env vars at `%s'";
panic_later = "env";
panic_param = param;
}
if (!strncmp(param, envp_init[i], val - param))
Expand All @@ -290,7 +290,7 @@ static int __init unknown_bootoption(char *param, char *val, const char *unused)
unsigned int i;
for (i = 0; argv_init[i]; i++) {
if (i == MAX_INIT_ARGS) {
panic_later = "Too many boot init vars at `%s'";
panic_later = "init";
panic_param = param;
}
}
Expand Down Expand Up @@ -582,7 +582,8 @@ asmlinkage void __init start_kernel(void)
*/
console_init();
if (panic_later)
panic(panic_later, panic_param);
panic("Too many boot %s vars at `%s'", panic_later,
panic_param);

lockdep_info();

Expand Down

0 comments on commit 499a458

Please sign in to comment.