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.
Unified · Split
| @@ -60,15 +60,8 @@ static void __init error(char *x) · 59 unmodified lines | ||
| 60 | 60 | message = x; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | −static void panic_show_mem(const char *fmt, ...) | |
| 64 | −{ | |
| 65 | − va_list args; | |
| 66 | − | |
| 67 | − show_mem(0, NULL); | |
| 68 | − va_start(args, fmt); | |
| 69 | − panic(fmt, args); | |
| 70 | − va_end(args); | |
| 71 | −} | |
| 63 | +#define panic_show_mem(fmt, ...) \ | |
| 64 | + ({ show_mem(0, NULL); panic(fmt, ##__VA_ARGS__); }) | |
| 72 | 65 | |
| 73 | 66 | /* link hash */ |
| 74 | 67 | |