tools/bootconfig: Fix error return code in apply_xbc()

commit e8ba0b2b64126381643bb50df3556b139a60545a upstream.

Fix to return a negative error code from the error handling case instead
of 0, as done elsewhere in this function.

Link: https://lkml.kernel.org/r/20210508034216.2277-1-thunder.leizhen@huawei.com

Fixes: a995e6bc05 ("tools/bootconfig: Fix to check the write failure correctly")
Reported-by: Hulk Robot <hulkci@huawei.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Zhen Lei 2021-05-08 11:42:16 +08:00 committed by Greg Kroah-Hartman
parent 16ccdcdfe6
commit c9cb5837e9

View File

@ -399,6 +399,7 @@ static int apply_xbc(const char *path, const char *xbc_path)
} }
/* TODO: Ensure the @path is initramfs/initrd image */ /* TODO: Ensure the @path is initramfs/initrd image */
if (fstat(fd, &stat) < 0) { if (fstat(fd, &stat) < 0) {
ret = -errno;
pr_err("Failed to get the size of %s\n", path); pr_err("Failed to get the size of %s\n", path);
goto out; goto out;
} }