From: Steven Rostedt (VMware) rostedt@goodmis.org
[ Upstream commit 9d82ccda2bc5c148060543d249d54f8703741bb4 ]
The return of apply_xbc() returns the result of the last write() call, which is not what is expected. It should only return zero on success.
Link: https://lore.kernel.org/r/20200508093059.GF9365@kadam
Fixes: 8842604446d1 ("tools/bootconfig: Fix resource leak in apply_xbc()") Reported-by: Dan Carpenter dan.carpenter@oracle.com Acked-by: Masami Hiramatsu mhiramat@kernel.org Tested-by: Masami Hiramatsu mhiramat@kernel.org Signed-off-by: Steven Rostedt (VMware) rostedt@goodmis.org Signed-off-by: Sasha Levin sashal@kernel.org --- tools/bootconfig/main.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c index 5dbe893cf00c..37fb2e85de12 100644 --- a/tools/bootconfig/main.c +++ b/tools/bootconfig/main.c @@ -310,6 +310,7 @@ int apply_xbc(const char *path, const char *xbc_path) pr_err("Failed to apply a boot config magic: %d\n", ret); goto out; } + ret = 0; out: close(fd); free(data);