mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
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>
This commit is contained in:
committed by
Steven Rostedt (VMware)
parent
6644c654ea
commit
bdac5c2b24
@@ -229,7 +229,7 @@ static int load_xbc_from_initrd(int fd, char **buf)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = xbc_init(*buf, &msg, NULL);
|
||||
ret = xbc_init(*buf, size, &msg, NULL);
|
||||
/* Wrong data */
|
||||
if (ret < 0) {
|
||||
pr_err("parse error: %s.\n", msg);
|
||||
@@ -269,7 +269,7 @@ static int init_xbc_with_error(char *buf, int len)
|
||||
if (!copy)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = xbc_init(buf, &msg, &pos);
|
||||
ret = xbc_init(buf, len, &msg, &pos);
|
||||
if (ret < 0)
|
||||
show_xbc_error(copy, msg, pos);
|
||||
free(copy);
|
||||
@@ -382,7 +382,7 @@ static int apply_xbc(const char *path, const char *xbc_path)
|
||||
memcpy(data, buf, size);
|
||||
|
||||
/* Check the data format */
|
||||
ret = xbc_init(buf, &msg, &pos);
|
||||
ret = xbc_init(buf, size, &msg, &pos);
|
||||
if (ret < 0) {
|
||||
show_xbc_error(data, msg, pos);
|
||||
free(data);
|
||||
|
||||
Reference in New Issue
Block a user