* [PATCH] tools/bootconfig: Fix apply_xbc() to return zero on success
@ 2020-05-08 15:13 Steven Rostedt
2020-05-08 23:14 ` Masami Hiramatsu
0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2020-05-08 15:13 UTC (permalink / raw)
To: LKML; +Cc: Masami Hiramatsu, Dan Carpenter, Yunfeng Ye, Shiyuan Hu, Hewenliang
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
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>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
tools/bootconfig/main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
index 001076c51712..0efaf45f7367 100644
--- a/tools/bootconfig/main.c
+++ b/tools/bootconfig/main.c
@@ -337,6 +337,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);
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tools/bootconfig: Fix apply_xbc() to return zero on success
2020-05-08 15:13 [PATCH] tools/bootconfig: Fix apply_xbc() to return zero on success Steven Rostedt
@ 2020-05-08 23:14 ` Masami Hiramatsu
2020-05-09 0:11 ` Masami Hiramatsu
0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2020-05-08 23:14 UTC (permalink / raw)
To: Steven Rostedt
Cc: LKML, Masami Hiramatsu, Dan Carpenter, Yunfeng Ye, Shiyuan Hu,
Hewenliang
On Fri, 8 May 2020 11:13:49 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>
> 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
>
Thanks for fixing!
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
> Fixes: 8842604446d1 ("tools/bootconfig: Fix resource leak in apply_xbc()")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
> tools/bootconfig/main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
> index 001076c51712..0efaf45f7367 100644
> --- a/tools/bootconfig/main.c
> +++ b/tools/bootconfig/main.c
> @@ -337,6 +337,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);
> --
> 2.20.1
>
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tools/bootconfig: Fix apply_xbc() to return zero on success
2020-05-08 23:14 ` Masami Hiramatsu
@ 2020-05-09 0:11 ` Masami Hiramatsu
2020-05-09 0:58 ` [PATCH] tools/bootconfig: Add a summary of test cases and return error Masami Hiramatsu
0 siblings, 1 reply; 4+ messages in thread
From: Masami Hiramatsu @ 2020-05-09 0:11 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Steven Rostedt, LKML, Dan Carpenter, Yunfeng Ye, Shiyuan Hu, Hewenliang
On Sat, 9 May 2020 08:14:24 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:
> On Fri, 8 May 2020 11:13:49 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> >
> > 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
> >
>
> Thanks for fixing!
>
> Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
>
Oh, and tested too.
---
...
test case 40 (samples/good-tree.bconf)...
Apply samples/good-tree.bconf to ./initrd-tNhd
Number of nodes: 16
Size: 136 bytes
Checksum: 9171
[OK]
All tests passed
---
Tested-by: Masami Hiramatsu <mhiramat@kernel.org>
BTW, I might better add a test summary to the test script (and move it
into kselftest?)
Thank you,
>
> > Fixes: 8842604446d1 ("tools/bootconfig: Fix resource leak in apply_xbc()")
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> > ---
> > tools/bootconfig/main.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
> > index 001076c51712..0efaf45f7367 100644
> > --- a/tools/bootconfig/main.c
> > +++ b/tools/bootconfig/main.c
> > @@ -337,6 +337,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);
> > --
> > 2.20.1
> >
>
>
> --
> Masami Hiramatsu <mhiramat@kernel.org>
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] tools/bootconfig: Add a summary of test cases and return error
2020-05-09 0:11 ` Masami Hiramatsu
@ 2020-05-09 0:58 ` Masami Hiramatsu
0 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2020-05-09 0:58 UTC (permalink / raw)
To: Steven Rostedt
Cc: LKML, Masami Hiramatsu, Dan Carpenter, Yunfeng Ye, Shiyuan Hu,
Hewenliang
Add summary lines of test cases and return an error
code if any test case fails so that tester don't have
to monitor the output.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
tools/bootconfig/test-bootconfig.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/bootconfig/test-bootconfig.sh b/tools/bootconfig/test-bootconfig.sh
index 81b350ffd03f..eff16b77d5eb 100755
--- a/tools/bootconfig/test-bootconfig.sh
+++ b/tools/bootconfig/test-bootconfig.sh
@@ -124,9 +124,16 @@ for i in samples/good-* ; do
xpass $BOOTCONF -a $i $INITRD
done
+
+echo
+echo "=== Summary ==="
+echo "# of Passed: $(expr $NO - $NG - 1)"
+echo "# of Failed: $NG"
+
echo
if [ $NG -eq 0 ]; then
echo "All tests passed"
else
echo "$NG tests failed"
+ exit 1
fi
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-09 0:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 15:13 [PATCH] tools/bootconfig: Fix apply_xbc() to return zero on success Steven Rostedt
2020-05-08 23:14 ` Masami Hiramatsu
2020-05-09 0:11 ` Masami Hiramatsu
2020-05-09 0:58 ` [PATCH] tools/bootconfig: Add a summary of test cases and return error Masami Hiramatsu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.