mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -tip and 2.6.33-rc8] [BUGFIX] perf probe: Init struct probe_point and set counter correctly
@ 2010-02-18 18:16 Masami Hiramatsu
  2010-02-22 11:04 ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
  0 siblings, 1 reply; 2+ messages in thread
From: Masami Hiramatsu @ 2010-02-18 18:16 UTC (permalink / raw)
  To: Ingo Molnar, lkml; +Cc: systemtap, DLE, Masami Hiramatsu, Ingo Molnar

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: Ingo Molnar <mingo@elte.hu>
---

 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 29465d4..fde17b0 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)
 	int ret;
 
 	pp->probes[0] = buf = zalloc(MAX_CMDLEN);
+	pp->found = 1;
 	if (!buf)
 		die("Failed to allocate memory by zalloc.");
 	if (pp->offset) {
@@ -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;
 }
@@ -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);


-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip:perf/urgent] perf probe: Init struct probe_point and set counter correctly
  2010-02-18 18:16 [PATCH -tip and 2.6.33-rc8] [BUGFIX] perf probe: Init struct probe_point and set counter correctly Masami Hiramatsu
@ 2010-02-22 11:04 ` tip-bot for Masami Hiramatsu
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Masami Hiramatsu @ 2010-02-22 11:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, paulus, hpa, mingo, a.p.zijlstra, efault,
	dle-develop, fweisbec, tglx, mhiramat, mingo, systemtap

Commit-ID:  388c3aab5d4f1b0bbfe2d5f47e7cd681866bc573
Gitweb:     http://git.kernel.org/tip/388c3aab5d4f1b0bbfe2d5f47e7cd681866bc573
Author:     Masami Hiramatsu <mhiramat@redhat.com>
AuthorDate: Thu, 18 Feb 2010 13:16:52 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 22 Feb 2010 11:42:27 +0100

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>
---
 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 29465d4..fde17b0 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)
 	int ret;
 
 	pp->probes[0] = buf = zalloc(MAX_CMDLEN);
+	pp->found = 1;
 	if (!buf)
 		die("Failed to allocate memory by zalloc.");
 	if (pp->offset) {
@@ -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;
 }
@@ -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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-22 11:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-18 18:16 [PATCH -tip and 2.6.33-rc8] [BUGFIX] perf probe: Init struct probe_point and set counter correctly Masami Hiramatsu
2010-02-22 11:04 ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome