Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1180714

[PATCH 30/39] perf probe: Reset args and nargs for probe_trace_event when failure

From Wang Nan <wangnan0@huawei.com>
Newsgroups linux.kernel
Subject [PATCH 30/39] perf probe: Reset args and nargs for probe_trace_event when failure
Date 2015-07-09 14:50 +0200
Message-ID <pKjr5-dD-41@gated-at.bofh.it> (permalink)
References <pKjhn-9T-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When failure occures in add_probe_trace_event(), args in
probe_trace_event is incomplete. Since information in it may be used
in further, this patch frees the allocated memory and set it to NULL
to avoid dangling pointer.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
---
 tools/perf/util/probe-finder.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 2da65a7..f533d19 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1243,6 +1243,10 @@ static int add_probe_trace_event(Dwarf_Die *sc_die, struct probe_finder *pf)
 
 end:
 	free(args);
+	if (ret) {
+		tev->nargs = 0;
+		zfree(&tev->args);
+	}
 	return ret;
 }
 
-- 
1.8.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/39] perf tools: filtering events using eBPF programs Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:40 +0200
  [PATCH 36/39] perf tools: Use same BPF program if arguments are identical Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 25/39] perf tools: Attach eBPF program to perf event Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 27/39] perf record: Add clang options for compiling BPF scripts Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 34/39] perf tools: Add prologue for BPF programs for fetching arguments Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 31/39] perf tools: Move linux/filter.h to tools/include Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 26/39] perf tools: Suppress probing messages when probing by BPF loading Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 28/39] bpf tools: Load a program with different instances using preprocessor Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
    Re: [PATCH 28/39] bpf tools: Load a program with different instances  using preprocessor "Wangnan (F)" <wangnan0@huawei.com> - 2015-07-13 08:00 +0200
  [PATCH 13/39] perf tools: Call clang to compile C source to object code Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 32/39] perf tools: Add BPF_PROLOGUE config options for further patches Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 06/39] bpf tools: Create eBPF maps defined in an object file Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
    Re: [PATCH 06/39] bpf tools: Create eBPF maps defined in an object  file "Wangnan (F)" <wangnan0@huawei.com> - 2015-07-14 06:10 +0200
  [PATCH 35/39] perf tools: Generate prologue for BPF programs Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 30/39] perf probe: Reset args and nargs for probe_trace_event when failure Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 18/39] perf record: Enable passing bpf object file to --event Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 14/39] perf tools: Auto detecting kernel build directory Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 23/39] perf record: Load all eBPF object into kernel Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 24/39] perf tools: Add bpf_fd field to evsel and config it Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 22/39] perf record: Probe at kprobe points Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 15/39] perf tools: Auto detecting kernel include options Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 29/39] perf tools: Fix probe-event.h include Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 02/39] bpf tools: Collect eBPF programs from their own sections Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
    Re: [PATCH 02/39] bpf tools: Collect eBPF programs from their own  sections "Wangnan (F)" <wangnan0@huawei.com> - 2015-07-10 05:20 +0200
      Re: [PATCH 02/39] bpf tools: Collect eBPF programs from their own  sections "Wangnan (F)" <wangnan0@huawei.com> - 2015-07-14 06:10 +0200
  [PATCH 21/39] perf probe: Attach trace_probe_event with perf_probe_event Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 09/39] bpf tools: Load eBPF programs in object files into kernel Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  [PATCH 37/39] perf record: Support custom vmlinux path Wang Nan <wangnan0@huawei.com> - 2015-07-09 14:50 +0200
  perf test LLVM was: Re: [GIT PULL 00/39] perf tools: filtering  events using eBPF programs Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-07-14 17:40 +0200
    Re: perf test LLVM was: Re: [GIT PULL 00/39] perf tools: filtering  events using eBPF programs "Wangnan (F)" <wangnan0@huawei.com> - 2015-07-15 13:10 +0200
      Re: perf test LLVM was: Re: [GIT PULL 00/39] perf tools: filtering  events using eBPF programs Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-07-15 13:30 +0200

csiph-web