提交 01b6e160 编写于 作者: Z Zhen Lei 提交者: Wang ShaoBo

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

stable inclusion
from stable-v5.10.44
commit c9cb5837e92ee3052e0e46e3cd1eb1f7a903411d
bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=451
CVE: NA

-------------------------------------------------

commit e8ba0b2b 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: a995e6bc ("tools/bootconfig: Fix to check the write failure correctly")
Reported-by: NHulk Robot <hulkci@huawei.com>
Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: NZhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NXiao <zju_xhy@163.com>
Reviewed-by: Jian Cheng <cj.chengjian(a)huawei.com>
Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
上级 9479babe
...@@ -399,6 +399,7 @@ static int apply_xbc(const char *path, const char *xbc_path) ...@@ -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;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册