Commit 499a4584d7f817d43d09ccfc6bb26315eeaab6bc
Committed by
Linus Torvalds
1 parent
128e3f4541
Exists in
master
and in
16 other branches
init: fix possible format string bug
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>
Showing 2 changed files with 5 additions and 4 deletions Side-by-side Diff
init/initramfs.c
... | ... | @@ -583,7 +583,7 @@ |
583 | 583 | { |
584 | 584 | char *err = unpack_to_rootfs(__initramfs_start, __initramfs_size); |
585 | 585 | if (err) |
586 | - panic(err); /* Failed to decompress INTERNAL initramfs */ | |
586 | + panic("%s", err); /* Failed to decompress INTERNAL initramfs */ | |
587 | 587 | if (initrd_start) { |
588 | 588 | #ifdef CONFIG_BLK_DEV_RAM |
589 | 589 | int fd; |
init/main.c
... | ... | @@ -278,7 +278,7 @@ |
278 | 278 | unsigned int i; |
279 | 279 | for (i = 0; envp_init[i]; i++) { |
280 | 280 | if (i == MAX_INIT_ENVS) { |
281 | - panic_later = "Too many boot env vars at `%s'"; | |
281 | + panic_later = "env"; | |
282 | 282 | panic_param = param; |
283 | 283 | } |
284 | 284 | if (!strncmp(param, envp_init[i], val - param)) |
... | ... | @@ -290,7 +290,7 @@ |
290 | 290 | unsigned int i; |
291 | 291 | for (i = 0; argv_init[i]; i++) { |
292 | 292 | if (i == MAX_INIT_ARGS) { |
293 | - panic_later = "Too many boot init vars at `%s'"; | |
293 | + panic_later = "init"; | |
294 | 294 | panic_param = param; |
295 | 295 | } |
296 | 296 | } |
... | ... | @@ -582,7 +582,8 @@ |
582 | 582 | */ |
583 | 583 | console_init(); |
584 | 584 | if (panic_later) |
585 | - panic(panic_later, panic_param); | |
585 | + panic("Too many boot %s vars at `%s'", panic_later, | |
586 | + panic_param); | |
586 | 587 | |
587 | 588 | lockdep_info(); |
588 | 589 |