Re: [PATCH bpf] tools: bpftool: return from do_event_pipe() on bad arguments
On 08/23/2018 07:48 PM, Quentin Monnet wrote: > 2018-08-23 20:35 UTC+0300 ~ Sergei Shtylyov > >> Hello! >> >> On 08/23/2018 07:46 PM, Quentin Monnet wrote: >> >>> When command line parsing fails in the while loop in do_event_pipe() >>> because the number of arguments is incorrect or because the keyword is >>> unknown, an error message is displayed, but bpfool >> >>bp-who? ;-) >> >>> remains stucked in >> >>Stuck. >> >>> the loop. Make sure we exit the loop upon failure. >>> >>> Fixes: f412eed9dfde ("tools: bpftool: add simple perf event output reader") >>> Signed-off-by: Quentin Monnet >>> Reviewed-by: Jakub Kicinski >> [...] >> >> MBR, Sergei > > Thanks Sergei! The patch has been applied so I cannot fix these, but > I'll make sure to give an additional pass to my future commit logs… I fixed the two commit log typos up, thanks.
Re: [PATCH bpf] tools: bpftool: return from do_event_pipe() on bad arguments
2018-08-23 20:35 UTC+0300 ~ Sergei Shtylyov > Hello! > > On 08/23/2018 07:46 PM, Quentin Monnet wrote: > >> When command line parsing fails in the while loop in do_event_pipe() >> because the number of arguments is incorrect or because the keyword is >> unknown, an error message is displayed, but bpfool > >bp-who? ;-) > >> remains stucked in > >Stuck. > >> the loop. Make sure we exit the loop upon failure. >> >> Fixes: f412eed9dfde ("tools: bpftool: add simple perf event output reader") >> Signed-off-by: Quentin Monnet >> Reviewed-by: Jakub Kicinski > [...] > > MBR, Sergei Thanks Sergei! The patch has been applied so I cannot fix these, but I'll make sure to give an additional pass to my future commit logs… Best, Quentin
Re: [PATCH bpf] tools: bpftool: return from do_event_pipe() on bad arguments
Hello! On 08/23/2018 07:46 PM, Quentin Monnet wrote: > When command line parsing fails in the while loop in do_event_pipe() > because the number of arguments is incorrect or because the keyword is > unknown, an error message is displayed, but bpfool bp-who? ;-) > remains stucked in Stuck. > the loop. Make sure we exit the loop upon failure. > > Fixes: f412eed9dfde ("tools: bpftool: add simple perf event output reader") > Signed-off-by: Quentin Monnet > Reviewed-by: Jakub Kicinski [...] MBR, Sergei
Re: [PATCH bpf] tools: bpftool: return from do_event_pipe() on bad arguments
On 08/23/2018 06:46 PM, Quentin Monnet wrote: > When command line parsing fails in the while loop in do_event_pipe() > because the number of arguments is incorrect or because the keyword is > unknown, an error message is displayed, but bpfool remains stucked in > the loop. Make sure we exit the loop upon failure. > > Fixes: f412eed9dfde ("tools: bpftool: add simple perf event output reader") > Signed-off-by: Quentin Monnet > Reviewed-by: Jakub Kicinski Applied to bpf, thanks Quentin!
[PATCH bpf] tools: bpftool: return from do_event_pipe() on bad arguments
When command line parsing fails in the while loop in do_event_pipe() because the number of arguments is incorrect or because the keyword is unknown, an error message is displayed, but bpfool remains stucked in the loop. Make sure we exit the loop upon failure. Fixes: f412eed9dfde ("tools: bpftool: add simple perf event output reader") Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski --- tools/bpf/bpftool/map_perf_ring.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/map_perf_ring.c b/tools/bpf/bpftool/map_perf_ring.c index 1832100d1b27..6d41323be291 100644 --- a/tools/bpf/bpftool/map_perf_ring.c +++ b/tools/bpf/bpftool/map_perf_ring.c @@ -194,8 +194,10 @@ int do_event_pipe(int argc, char **argv) } while (argc) { - if (argc < 2) + if (argc < 2) { BAD_ARG(); + goto err_close_map; + } if (is_prefix(*argv, "cpu")) { char *endptr; @@ -221,6 +223,7 @@ int do_event_pipe(int argc, char **argv) NEXT_ARG(); } else { BAD_ARG(); + goto err_close_map; } do_all = false; -- 2.14.1