Skip to contentSkip to conversation

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

PATCH In review Zhen Lei 3 participants 3 messages May 8, 2021 – May 23, 2021 Extra boot config

lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

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

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

Fixes a995e6bc0524 ("tools/bootconfig: Fix to check the write failure correctly")
---
 tools/bootconfig/main.c | 1 +
 1 file changed, 1 insertion(+)
tools/bootconfig/main.c +1 -0
index 7362bef1a368..6cd6080cac04 100644
@@ -399,6 +399,7 @@ static int apply_xbc(const char *path, const char *xbc_path)
 	}
 	/* TODO: Ensure the @path is initramfs/initrd image */
 	if (fstat(fd, &stat) < 0) {
+		ret = -errno;
 		pr_err("Failed to get the size of %s\n", path);
 		goto out;
 	}
Signature · 1 line
2.25.1
#1 lore raw
Quoted 6 lines · On Sat, 8 May 2021 11:42:16 +0800 Zhen Lei <[email protected]> wrote:

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

Fixes a995e6bc0524 ("tools/bootconfig: Fix to check the write failure correctly")

Masami, care to ack this?

-- Steve

Quoted 16 lines
---
 tools/bootconfig/main.c | 1 +
 1 file changed, 1 insertion(+)
tools/bootconfig/main.c +1 -0
index 7362bef1a368..6cd6080cac04 100644
@@ -399,6 +399,7 @@ static int apply_xbc(const char *path, const char *xbc_path)
 	}
 	/* TODO: Ensure the @path is initramfs/initrd image */
 	if (fstat(fd, &stat) < 0) {
+		ret = -errno;
 		pr_err("Failed to get the size of %s\n", path);
 		goto out;
 	}
maintainer Acked-by
#2 lore raw
Quoted 11 lines · On Fri, 14 May 2021 18:32:38 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 6 lines · On Sat, 8 May 2021 11:42:16 +0800 Zhen Lei <[email protected]> wrote:

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

Fixes a995e6bc0524 ("tools/bootconfig: Fix to check the write failure correctly")

Masami, care to ack this?

Oops, I missed this patch. Sorry.

This looks good to me.

Thank you!

Quoted 20 lines

-- Steve

Quoted 16 lines
---
 tools/bootconfig/main.c | 1 +
 1 file changed, 1 insertion(+)
tools/bootconfig/main.c +1 -0
index 7362bef1a368..6cd6080cac04 100644
@@ -399,6 +399,7 @@ static int apply_xbc(const char *path, const char *xbc_path)
 	}
 	/* TODO: Ensure the @path is initramfs/initrd image */
 	if (fstat(fd, &stat) < 0) {
+		ret = -errno;
 		pr_err("Failed to get the size of %s\n", path);
 		goto out;
 	}
Signature · 1 line
Masami Hiramatsu <[email protected]>