linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/bpf/bpftool: Fix wrong return value in do_dump()
@ 2020-08-02 11:15 Tianjia Zhang
  2020-08-03  1:16 ` Andrii Nakryiko
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tianjia Zhang @ 2020-08-02 11:15 UTC (permalink / raw)
  To: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
	kpsingh, quentin, kuba, toke, tklauser, tianjia.zhang, jolsa
  Cc: netdev, bpf, linux-kernel, tianjia.zhang

In case of btf_id does not exist, a negative error code -ENOENT
should be returned.

Fixes: c93cc69004df3 ("bpftool: add ability to dump BTF types")
Cc: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
 tools/bpf/bpftool/btf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c
index faac8189b285..c2f1fd414820 100644
--- a/tools/bpf/bpftool/btf.c
+++ b/tools/bpf/bpftool/btf.c
@@ -596,7 +596,7 @@ static int do_dump(int argc, char **argv)
 			goto done;
 		}
 		if (!btf) {
-			err = ENOENT;
+			err = -ENOENT;
 			p_err("can't find btf with ID (%u)", btf_id);
 			goto done;
 		}
-- 
2.26.2


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

end of thread, other threads:[~2020-08-03 14:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-02 11:15 [PATCH] tools/bpf/bpftool: Fix wrong return value in do_dump() Tianjia Zhang
2020-08-03  1:16 ` Andrii Nakryiko
2020-08-03  5:04   ` John Fastabend
2020-08-03  8:41 ` Tobias Klauser
2020-08-03 14:33 ` Daniel Borkmann

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).