diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2010-02-18 13:16:52 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-02-22 05:42:27 -0500 |
commit | 388c3aab5d4f1b0bbfe2d5f47e7cd681866bc573 (patch) | |
tree | 99024d3b3807219c3713babcf2077f59b7847475 /tools | |
parent | 326264a02448b0ac51f78f178b78e830aa077a0b (diff) |
perf probe: Init struct probe_point and set counter correctly
Clear struct probe_point before using it in
show_perf_probe_events(), and set pp->found counter correctly in
synthesize_perf_probe_point(). Without this initialization,
clear_probe_point() will free random addresses.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
LKML-Reference: <20100218181652.26547.57790.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/probe-event.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 29465d440043..fde17b090a47 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -272,6 +272,7 @@ int synthesize_perf_probe_point(struct probe_point *pp) | |||
272 | int ret; | 272 | int ret; |
273 | 273 | ||
274 | pp->probes[0] = buf = zalloc(MAX_CMDLEN); | 274 | pp->probes[0] = buf = zalloc(MAX_CMDLEN); |
275 | pp->found = 1; | ||
275 | if (!buf) | 276 | if (!buf) |
276 | die("Failed to allocate memory by zalloc."); | 277 | die("Failed to allocate memory by zalloc."); |
277 | if (pp->offset) { | 278 | if (pp->offset) { |
@@ -294,6 +295,7 @@ int synthesize_perf_probe_point(struct probe_point *pp) | |||
294 | error: | 295 | error: |
295 | free(pp->probes[0]); | 296 | free(pp->probes[0]); |
296 | pp->probes[0] = NULL; | 297 | pp->probes[0] = NULL; |
298 | pp->found = 0; | ||
297 | } | 299 | } |
298 | return ret; | 300 | return ret; |
299 | } | 301 | } |
@@ -455,6 +457,7 @@ void show_perf_probe_events(void) | |||
455 | struct strlist *rawlist; | 457 | struct strlist *rawlist; |
456 | struct str_node *ent; | 458 | struct str_node *ent; |
457 | 459 | ||
460 | memset(&pp, 0, sizeof(pp)); | ||
458 | fd = open_kprobe_events(O_RDONLY, 0); | 461 | fd = open_kprobe_events(O_RDONLY, 0); |
459 | rawlist = get_trace_kprobe_event_rawlist(fd); | 462 | rawlist = get_trace_kprobe_event_rawlist(fd); |
460 | close(fd); | 463 | close(fd); |