Skip to content

Commit

Permalink
perf probe: Init struct probe_point and set counter correctly
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: systemtap <[email protected]>
Cc: DLE <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Masami Hiramatsu authored and Ingo Molnar committed Feb 22, 2010
1 parent 326264a commit 388c3aa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/perf/util/probe-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ int synthesize_perf_probe_point(struct probe_point *pp)
int ret;

pp->probes[0] = buf = zalloc(MAX_CMDLEN);
pp->found = 1;
if (!buf)
die("Failed to allocate memory by zalloc.");
if (pp->offset) {
Expand All @@ -294,6 +295,7 @@ int synthesize_perf_probe_point(struct probe_point *pp)
error:
free(pp->probes[0]);
pp->probes[0] = NULL;
pp->found = 0;
}
return ret;
}
Expand Down Expand Up @@ -455,6 +457,7 @@ void show_perf_probe_events(void)
struct strlist *rawlist;
struct str_node *ent;

memset(&pp, 0, sizeof(pp));
fd = open_kprobe_events(O_RDONLY, 0);
rawlist = get_trace_kprobe_event_rawlist(fd);
close(fd);
Expand Down

0 comments on commit 388c3aa

Please sign in to comment.