summaryrefslogtreecommitdiffstats
path: root/init/main.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2021-09-16 08:23:20 +0200
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2021-10-11 02:43:42 +0200
commitbdac5c2b243f68ec15f8203c3348ae79fee8e8d8 (patch)
treea48e16528af72efc5e487565cde23a1de5a9a38b /init/main.c
parentftrace: Cleanup ftrace_dyn_arch_init() (diff)
downloadlinux-bdac5c2b243f68ec15f8203c3348ae79fee8e8d8.tar.xz
linux-bdac5c2b243f68ec15f8203c3348ae79fee8e8d8.zip
bootconfig: Allocate xbc_data inside xbc_init()
Allocate 'xbc_data' in the xbc_init() so that it does not need to care about the ownership of the copied data. Link: https://lkml.kernel.org/r/163177339986.682366.898762699429769117.stgit@devnote2 Suggested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'init/main.c')
-rw-r--r--init/main.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/init/main.c b/init/main.c
index 81a79a77db46..d894989d86bc 100644
--- a/init/main.c
+++ b/init/main.c
@@ -409,7 +409,7 @@ static void __init setup_boot_config(void)
const char *msg;
int pos;
u32 size, csum;
- char *data, *copy, *err;
+ char *data, *err;
int ret;
/* Cut out the bootconfig data even if we have no bootconfig option */
@@ -442,16 +442,7 @@ static void __init setup_boot_config(void)
return;
}
- copy = memblock_alloc(size + 1, SMP_CACHE_BYTES);
- if (!copy) {
- pr_err("Failed to allocate memory for bootconfig\n");
- return;
- }
-
- memcpy(copy, data, size);
- copy[size] = '\0';
-
- ret = xbc_init(copy, &msg, &pos);
+ ret = xbc_init(data, size, &msg, &pos);
if (ret < 0) {
if (pos < 0)
pr_err("Failed to init bootconfig: %s.\n", msg);