Commit 735faf92 authored by Benjamin Gray's avatar Benjamin Gray Committed by Masahiro Yamada

init/initramfs: Fix argument forwarding to panic() in panic_show_mem()

Forwarding variadic argument lists can't be done by passing a va_list
to a function with signature foo(...) (as panic() has). It ends up
interpreting the va_list itself as a single argument instead of
iterating it. printf() happily accepts it of course, leading to corrupt
output.

Convert panic_show_mem() to a macro to allow forwarding the arguments.
The function is trivial enough that it's easier than trying to introduce
a vpanic() variant.
Signed-off-by: default avatarBenjamin Gray <bgray@linux.ibm.com>
Reviewed-by: default avatarAndrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent 5efb685b
...@@ -60,15 +60,8 @@ static void __init error(char *x) ...@@ -60,15 +60,8 @@ static void __init error(char *x)
message = x; message = x;
} }
static void panic_show_mem(const char *fmt, ...) #define panic_show_mem(fmt, ...) \
{ ({ show_mem(0, NULL); panic(fmt, ##__VA_ARGS__); })
va_list args;
show_mem(0, NULL);
va_start(args, fmt);
panic(fmt, args);
va_end(args);
}
/* link hash */ /* link hash */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment