linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/bpftool: Fix error return code in do_batch()
@ 2021-06-09 11:59 Zhihao Cheng
  2021-06-09 13:34 ` Quentin Monnet
  0 siblings, 1 reply; 3+ messages in thread
From: Zhihao Cheng @ 2021-06-09 11:59 UTC (permalink / raw)
  To: ast, daniel, andrii, quentin, kuba
  Cc: netdev, bpf, linux-kernel, chengzhihao1, yukuai3

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

Fixes: 668da745af3c2 ("tools: bpftool: add support for quotations ...")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
---
 tools/bpf/bpftool/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
index 7f2817d97079..3ddfd4843738 100644
--- a/tools/bpf/bpftool/main.c
+++ b/tools/bpf/bpftool/main.c
@@ -341,8 +341,10 @@ static int do_batch(int argc, char **argv)
 		n_argc = make_args(buf, n_argv, BATCH_ARG_NB_MAX, lines);
 		if (!n_argc)
 			continue;
-		if (n_argc < 0)
+		if (n_argc < 0) {
+			err = n_argc;
 			goto err_close;
+		}
 
 		if (json_output) {
 			jsonw_start_object(json_wtr);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools/bpftool: Fix error return code in do_batch()
  2021-06-09 11:59 [PATCH] tools/bpftool: Fix error return code in do_batch() Zhihao Cheng
@ 2021-06-09 13:34 ` Quentin Monnet
  2021-06-15  6:23   ` Andrii Nakryiko
  0 siblings, 1 reply; 3+ messages in thread
From: Quentin Monnet @ 2021-06-09 13:34 UTC (permalink / raw)
  To: Zhihao Cheng, ast, daniel, andrii, kuba
  Cc: netdev, bpf, linux-kernel, yukuai3

2021-06-09 19:59 UTC+0800 ~ Zhihao Cheng <chengzhihao1@huawei.com>
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
> 
> Fixes: 668da745af3c2 ("tools: bpftool: add support for quotations ...")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>

Reviewed-by: Quentin Monnet <quentin@isovalent.com>

Thank you for the fix.
Quentin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools/bpftool: Fix error return code in do_batch()
  2021-06-09 13:34 ` Quentin Monnet
@ 2021-06-15  6:23   ` Andrii Nakryiko
  0 siblings, 0 replies; 3+ messages in thread
From: Andrii Nakryiko @ 2021-06-15  6:23 UTC (permalink / raw)
  To: Quentin Monnet
  Cc: Zhihao Cheng, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Jakub Kicinski, Networking, bpf, open list,
	yukuai (C)

On Wed, Jun 9, 2021 at 6:34 AM Quentin Monnet <quentin@isovalent.com> wrote:
>
> 2021-06-09 19:59 UTC+0800 ~ Zhihao Cheng <chengzhihao1@huawei.com>
> > Fix to return a negative error code from the error handling
> > case instead of 0, as done elsewhere in this function.
> >
> > Fixes: 668da745af3c2 ("tools: bpftool: add support for quotations ...")
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
>
> Reviewed-by: Quentin Monnet <quentin@isovalent.com>
>
> Thank you for the fix.

This has been applied to bpf-next last Friday. Patchbot missed it.

> Quentin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-15  6:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 11:59 [PATCH] tools/bpftool: Fix error return code in do_batch() Zhihao Cheng
2021-06-09 13:34 ` Quentin Monnet
2021-06-15  6:23   ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).