[net-next,3/8] tools: bpftool: use err() instead of info() if there are too many insns

Message ID 20171019224626.31608-4-jakub.kicinski@netronome.com
State Accepted
Delegated to: David Miller
Headers show
Series
  • tools: bpftool: add a "version" command, and fix several items
Related show

Commit Message

Jakub Kicinski Oct. 19, 2017, 10:46 p.m.
From: Quentin Monnet <quentin.monnet@netronome.com>

Make error messages and return codes more consistent. Specifically,
replace the use of info() macro with err() when too many eBPF
instructions are received to be dumped, given that bpftool returns with
a non-null exit value in that case.

Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 tools/bpf/bpftool/prog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Borkmann Oct. 20, 2017, 10:55 a.m. | #1
On 10/20/2017 12:46 AM, Jakub Kicinski wrote:
> From: Quentin Monnet <quentin.monnet@netronome.com>
>
> Make error messages and return codes more consistent. Specifically,
> replace the use of info() macro with err() when too many eBPF
> instructions are received to be dumped, given that bpftool returns with
> a non-null exit value in that case.
>
> Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

Patch

diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index ede7957adcd9..6c03d2ea3f79 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -416,7 +416,7 @@  static int do_dump(int argc, char **argv)
 	}
 
 	if (*member_len > buf_size) {
-		info("too many instructions returned\n");
+		err("too many instructions returned\n");
 		goto err_free;
 	}