bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Quentin Monnet <quentin.monnet@netronome.com>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org,
	oss-drivers@netronome.com,
	Quentin Monnet <quentin.monnet@netronome.com>
Subject: [PATCH bpf 1/6] tools: bpftool: fix arguments for p_err() in do_event_pipe()
Date: Thu, 15 Aug 2019 15:32:15 +0100	[thread overview]
Message-ID: <20190815143220.4199-2-quentin.monnet@netronome.com> (raw)
In-Reply-To: <20190815143220.4199-1-quentin.monnet@netronome.com>

The last argument passed to some calls to the p_err() functions is not
correct, it should be "*argv" instead of "**argv". This may lead to a
segmentation fault error if CPU IDs or indices from the command line
cannot be parsed correctly. Let's fix this.

Fixes: f412eed9dfde ("tools: bpftool: add simple perf event output reader")
Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 tools/bpf/bpftool/map_perf_ring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/bpf/bpftool/map_perf_ring.c b/tools/bpf/bpftool/map_perf_ring.c
index 3f108ab17797..4c5531d1a450 100644
--- a/tools/bpf/bpftool/map_perf_ring.c
+++ b/tools/bpf/bpftool/map_perf_ring.c
@@ -157,7 +157,7 @@ int do_event_pipe(int argc, char **argv)
 			NEXT_ARG();
 			ctx.cpu = strtoul(*argv, &endptr, 0);
 			if (*endptr) {
-				p_err("can't parse %s as CPU ID", **argv);
+				p_err("can't parse %s as CPU ID", *argv);
 				goto err_close_map;
 			}
 
@@ -168,7 +168,7 @@ int do_event_pipe(int argc, char **argv)
 			NEXT_ARG();
 			ctx.idx = strtoul(*argv, &endptr, 0);
 			if (*endptr) {
-				p_err("can't parse %s as index", **argv);
+				p_err("can't parse %s as index", *argv);
 				goto err_close_map;
 			}
 
-- 
2.17.1


  reply	other threads:[~2019-08-15 14:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15 14:32 [PATCH bpf 0/6] tools: bpftool: fix printf()-like functions Quentin Monnet
2019-08-15 14:32 ` Quentin Monnet [this message]
2019-08-15 14:32 ` [PATCH bpf 2/6] tools: bpftool: fix format strings and arguments for jsonw_printf() Quentin Monnet
2019-08-15 14:32 ` [PATCH bpf 3/6] tools: bpftool: fix argument for p_err() in BTF do_dump() Quentin Monnet
2019-08-15 14:32 ` [PATCH bpf 4/6] tools: bpftool: fix format string for p_err() in query_flow_dissector() Quentin Monnet
2019-08-15 14:32 ` [PATCH bpf 5/6] tools: bpftool: fix format string for p_err() in detect_common_prefix() Quentin Monnet
2019-08-15 14:32 ` [PATCH bpf 6/6] tools: bpftool: move "__printf()" attributes to header file Quentin Monnet
2019-08-16  5:08 ` [PATCH bpf 0/6] tools: bpftool: fix printf()-like functions Alexei Starovoitov
2019-08-16 16:41   ` Quentin Monnet
2019-08-16 17:11     ` Alexei Starovoitov
2019-08-16 17:18       ` Quentin Monnet
2019-08-16 17:51       ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190815143220.4199-2-quentin.monnet@netronome.com \
    --to=quentin.monnet@netronome.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).