mirror of
https://github.com/torvalds/linux.git
synced 2025-04-06 00:16:18 +00:00
initramfs: avoid static buffer for error message
The dynamic error message printed if CONFIG_RD_$ALG compression support is missing needn't be propagated up to the caller via a static buffer. Print it immediately via pr_err() and set @message to a const string to flag error. Before: text data bss dec hex filename 8006 1118 8 9132 23ac init/initramfs.o After: text data bss dec hex filename 7938 1022 8 8968 2308 init/initramfs.o Signed-off-by: David Disseldorp <ddiss@suse.de> Link: https://lore.kernel.org/r/20250304061020.9815-9-ddiss@suse.de Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
225034cd51
commit
7a329ed2de
@ -511,7 +511,6 @@ char * __init unpack_to_rootfs(char *buf, unsigned long len)
|
||||
long written;
|
||||
decompress_fn decompress;
|
||||
const char *compress_name;
|
||||
static __initdata char msg_buf[64];
|
||||
struct {
|
||||
char header[CPIO_HDRLEN];
|
||||
char symlink[PATH_MAX + N_ALIGN(PATH_MAX) + 1];
|
||||
@ -552,12 +551,9 @@ char * __init unpack_to_rootfs(char *buf, unsigned long len)
|
||||
if (res)
|
||||
error("decompressor failed");
|
||||
} else if (compress_name) {
|
||||
if (!message) {
|
||||
snprintf(msg_buf, sizeof msg_buf,
|
||||
"compression method %s not configured",
|
||||
compress_name);
|
||||
message = msg_buf;
|
||||
}
|
||||
pr_err("compression method %s not configured\n",
|
||||
compress_name);
|
||||
error("decompressor failed");
|
||||
} else
|
||||
error("invalid magic at start of compressed archive");
|
||||
if (state != Reset)
|
||||
|
Loading…
x
Reference in New Issue
Block a user