public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [BUGFIX PATCH -tip 3/5] perf probe: Fix event namelist to duplicate  string
  2009-12-07 16:56 [BUGFIX PATCH -tip 0/5] perf-probe/x86 insn decoder bugfixes Masami Hiramatsu
                   ` (2 preceding siblings ...)
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 5/5] perf probe: Use pr_debug for debug message Masami Hiramatsu
@ 2009-12-07 16:56 ` Masami Hiramatsu
  2009-12-07 17:38   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 1/5] x86 insn: Delete empty or incomplete inat-tables.c Masami Hiramatsu
  4 siblings, 1 reply; 10+ messages in thread
From: Masami Hiramatsu @ 2009-12-07 16:56 UTC (permalink / raw)
  To: Ingo Molnar, Frederic Weisbecker, lkml
  Cc: systemtap, DLE, Masami Hiramatsu, Ingo Molnar,
	Frederic Weisbecker, Arnaldo Carvalho de Melo

Fix event namelist to duplicate string. Without duplicating,
adding multiple probes causes stack overwrite bug, because
it reuses a buffer on stack while the buffer is already
added in the namelist. String duplication solves this bug
because only contents of the buffer is copied to the namelist.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---

 tools/perf/util/probe-event.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index cd7fbda..de0d913 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -413,12 +413,13 @@ static struct strlist *get_perf_event_names(int fd)
 
 	rawlist = get_trace_kprobe_event_rawlist(fd);
 
-	sl = strlist__new(false, NULL);
+	sl = strlist__new(true, NULL);
 	for (i = 0; i < strlist__nr_entries(rawlist); i++) {
 		ent = strlist__entry(rawlist, i);
 		parse_trace_kprobe_event(ent->s, &group, &event, NULL);
 		strlist__add(sl, event);
 		free(group);
+		free(event);
 	}
 
 	strlist__delete(rawlist);
@@ -480,5 +481,6 @@ void add_trace_kprobe_events(struct probe_point *probes, int nr_probes)
 			strlist__add(namelist, event);
 		}
 	}
+	strlist__delete(namelist);
 	close(fd);
 }


-- 
Masami Hiramatsu

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

e-mail: mhiramat@redhat.com

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

* [BUGFIX PATCH -tip 4/5] perf probe: Check e_snprintf() format string
  2009-12-07 16:56 [BUGFIX PATCH -tip 0/5] perf-probe/x86 insn decoder bugfixes Masami Hiramatsu
@ 2009-12-07 16:56 ` Masami Hiramatsu
  2009-12-07 17:39   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 2/5] perf probe: Fix strtailcmp() to compare s1[0] and s2[0] Masami Hiramatsu
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Masami Hiramatsu @ 2009-12-07 16:56 UTC (permalink / raw)
  To: Ingo Molnar, Frederic Weisbecker, lkml
  Cc: systemtap, DLE, Masami Hiramatsu, Ingo Molnar,
	Frederic Weisbecker, Arnaldo Carvalho de Melo

Check e_snprintf() format string by gcc, and fix a bug of
e_snprintf() caller.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---

 tools/perf/util/probe-event.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index de0d913..88e1804 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -48,6 +48,9 @@
 
 /* If there is no space to write, returns -E2BIG. */
 static int e_snprintf(char *str, size_t size, const char *format, ...)
+	__attribute__((format(printf, 3, 4)));
+
+static int e_snprintf(char *str, size_t size, const char *format, ...)
 {
 	int ret;
 	va_list ap;
@@ -258,7 +261,7 @@ int synthesize_perf_probe_event(struct probe_point *pp)
 		ret = e_snprintf(buf, MAX_CMDLEN, "%s%s%s%s", pp->function,
 				 offs, pp->retprobe ? "%return" : "", line);
 	else
-		ret = e_snprintf(buf, MAX_CMDLEN, "%s%s%s%s", pp->file, line);
+		ret = e_snprintf(buf, MAX_CMDLEN, "%s%s", pp->file, line);
 	if (ret <= 0)
 		goto error;
 	len = ret;


-- 
Masami Hiramatsu

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

e-mail: mhiramat@redhat.com

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

* [BUGFIX PATCH -tip 1/5] x86 insn: Delete empty or incomplete  inat-tables.c
  2009-12-07 16:56 [BUGFIX PATCH -tip 0/5] perf-probe/x86 insn decoder bugfixes Masami Hiramatsu
                   ` (3 preceding siblings ...)
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 3/5] perf probe: Fix event namelist to duplicate string Masami Hiramatsu
@ 2009-12-07 16:56 ` Masami Hiramatsu
  2009-12-07 17:38   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
  4 siblings, 1 reply; 10+ messages in thread
From: Masami Hiramatsu @ 2009-12-07 16:56 UTC (permalink / raw)
  To: Ingo Molnar, Frederic Weisbecker, lkml
  Cc: systemtap, DLE, Masami Hiramatsu, Arkadiusz Miskiewicz,
	Jens Axboe, Ingo Molnar

Delete empty or incomplete inat-tables.c if gen-insn-attr-x86.awk
failed, because it causes a build error if user tries to build
kernel next time.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Reported-by: Arkadiusz Miskiewicz <arekm@maven.pl>
Cc: Arkadiusz Miskiewicz <arekm@maven.pl>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>
---

 arch/x86/lib/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 442b3b3..45b20e4 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -5,7 +5,7 @@
 inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk
 inat_tables_maps = $(srctree)/arch/x86/lib/x86-opcode-map.txt
 quiet_cmd_inat_tables = GEN     $@
-      cmd_inat_tables = $(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@
+      cmd_inat_tables = $(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@
 
 $(obj)/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
 	$(call cmd,inat_tables)


-- 
Masami Hiramatsu

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

e-mail: mhiramat@redhat.com

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

* [BUGFIX PATCH -tip 5/5] perf probe: Use pr_debug for debug message
  2009-12-07 16:56 [BUGFIX PATCH -tip 0/5] perf-probe/x86 insn decoder bugfixes Masami Hiramatsu
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 4/5] perf probe: Check e_snprintf() format string Masami Hiramatsu
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 2/5] perf probe: Fix strtailcmp() to compare s1[0] and s2[0] Masami Hiramatsu
@ 2009-12-07 16:56 ` Masami Hiramatsu
  2009-12-07 17:38   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 3/5] perf probe: Fix event namelist to duplicate string Masami Hiramatsu
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 1/5] x86 insn: Delete empty or incomplete inat-tables.c Masami Hiramatsu
  4 siblings, 1 reply; 10+ messages in thread
From: Masami Hiramatsu @ 2009-12-07 16:56 UTC (permalink / raw)
  To: Ingo Molnar, Frederic Weisbecker, lkml
  Cc: systemtap, DLE, Masami Hiramatsu, Ingo Molnar,
	Frederic Weisbecker, Arnaldo Carvalho de Melo

Use pr_debug() for "missing vmlinux" debugging message.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---

 tools/perf/builtin-probe.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index a58e11b..8993a1f 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -194,8 +194,8 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
 		if (session.need_dwarf)
 			die("Could not open vmlinux/module file.");
 
-		pr_warning("Could not open vmlinux/module file."
-			   " Try to use symbols.\n");
+		pr_debug("Could not open vmlinux/module file."
+			 " Try to use symbols.\n");
 		goto end_dwarf;
 	}
 


-- 
Masami Hiramatsu

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

e-mail: mhiramat@redhat.com

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

* [BUGFIX PATCH -tip 0/5] perf-probe/x86 insn decoder bugfixes
@ 2009-12-07 16:56 Masami Hiramatsu
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 4/5] perf probe: Check e_snprintf() format string Masami Hiramatsu
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Masami Hiramatsu @ 2009-12-07 16:56 UTC (permalink / raw)
  To: Ingo Molnar, Frederic Weisbecker, lkml; +Cc: systemtap, DLE

Hi Ingo,

Here are several bugfixes which are reported on LKML
for perf-probe and x86 insn decoder.

Thank you,

---

Juha Leppanen (1):
      perf probe: Fix strtailcmp() to compare s1[0] and s2[0]

Masami Hiramatsu (4):
      perf probe: Use pr_debug for debug message
      perf probe: Check e_snprintf() format string
      perf probe: Fix event namelist to duplicate string
      x86 insn: Delete empty or incomplete inat-tables.c


 arch/x86/lib/Makefile          |    2 +-
 tools/perf/builtin-probe.c     |    4 ++--
 tools/perf/util/probe-event.c  |    9 +++++++--
 tools/perf/util/probe-finder.c |    2 +-
 4 files changed, 11 insertions(+), 6 deletions(-)

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com

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

* [BUGFIX PATCH -tip 2/5] perf probe: Fix strtailcmp() to compare s1[0]  and s2[0]
  2009-12-07 16:56 [BUGFIX PATCH -tip 0/5] perf-probe/x86 insn decoder bugfixes Masami Hiramatsu
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 4/5] perf probe: Check e_snprintf() format string Masami Hiramatsu
@ 2009-12-07 16:56 ` Masami Hiramatsu
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 5/5] perf probe: Use pr_debug for debug message Masami Hiramatsu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Masami Hiramatsu @ 2009-12-07 16:56 UTC (permalink / raw)
  To: Ingo Molnar, Frederic Weisbecker, lkml
  Cc: systemtap, DLE, Juha Leppanen, Masami Hiramatsu

From: Juha Leppanen <juha_motorsportcom@luukku.com>

Fix strtailcmp() to compare s1[0] and s2[0].
strtailcmp() returns 0 if "a" and "b" or "a" and "ab", it's
a wrong behavior. This patch fixes it.

Signed-off-by: "Juha Leppanen" <juha_motorsportcom@luukku.com>
Reported-by: "Juha Leppanen" <juha_motorsportcom@luukku.com>
Acked-by: Masami Hiramatsu <mhiramat@redhat.com>
---

 tools/perf/util/probe-finder.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 293cdfc..4585f1d 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -106,7 +106,7 @@ static int strtailcmp(const char *s1, const char *s2)
 {
 	int i1 = strlen(s1);
 	int i2 = strlen(s2);
-	while (--i1 > 0 && --i2 > 0) {
+	while (--i1 >= 0 && --i2 >= 0) {
 		if (s1[i1] != s2[i2])
 			return s1[i1] - s2[i2];
 	}


-- 
Masami Hiramatsu

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

e-mail: mhiramat@redhat.com

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

* [tip:perf/urgent] perf probe: Use pr_debug for debug message
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 5/5] perf probe: Use pr_debug for debug message Masami Hiramatsu
@ 2009-12-07 17:38   ` tip-bot for Masami Hiramatsu
  0 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Masami Hiramatsu @ 2009-12-07 17:38 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, hpa, mingo, dle-develop, fweisbec, tglx,
	mhiramat, mingo, systemtap

Commit-ID:  d3a2dbf844d81b4b9c9ad6044563c294e7a48cac
Gitweb:     http://git.kernel.org/tip/d3a2dbf844d81b4b9c9ad6044563c294e7a48cac
Author:     Masami Hiramatsu <mhiramat@redhat.com>
AuthorDate: Mon, 7 Dec 2009 12:00:59 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 7 Dec 2009 18:33:22 +0100

perf probe: Use pr_debug for debug message

Use pr_debug() for "missing vmlinux" debugging message.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20091207170059.19230.51459.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/builtin-probe.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index a58e11b..8993a1f 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -194,8 +194,8 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used)
 		if (session.need_dwarf)
 			die("Could not open vmlinux/module file.");
 
-		pr_warning("Could not open vmlinux/module file."
-			   " Try to use symbols.\n");
+		pr_debug("Could not open vmlinux/module file."
+			 " Try to use symbols.\n");
 		goto end_dwarf;
 	}
 

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

* [tip:perf/urgent] perf probe: Fix event namelist to duplicate string
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 3/5] perf probe: Fix event namelist to duplicate string Masami Hiramatsu
@ 2009-12-07 17:38   ` tip-bot for Masami Hiramatsu
  0 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Masami Hiramatsu @ 2009-12-07 17:38 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, hpa, mingo, dle-develop, fweisbec, tglx,
	mhiramat, mingo, systemtap

Commit-ID:  e1d2017b24fb31602f1128e6a8b2afc54c9283cd
Gitweb:     http://git.kernel.org/tip/e1d2017b24fb31602f1128e6a8b2afc54c9283cd
Author:     Masami Hiramatsu <mhiramat@redhat.com>
AuthorDate: Mon, 7 Dec 2009 12:00:46 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 7 Dec 2009 18:33:21 +0100

perf probe: Fix event namelist to duplicate string

Fix event namelist to duplicate string. Without duplicating, adding
multiple probes causes stack overwrite bug, because it reuses a
buffer on stack while the buffer is already added in the namelist.
String duplication solves this bug because only contents of the
buffer is copied to the namelist.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20091207170046.19230.55557.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/util/probe-event.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index cd7fbda..de0d913 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -413,12 +413,13 @@ static struct strlist *get_perf_event_names(int fd)
 
 	rawlist = get_trace_kprobe_event_rawlist(fd);
 
-	sl = strlist__new(false, NULL);
+	sl = strlist__new(true, NULL);
 	for (i = 0; i < strlist__nr_entries(rawlist); i++) {
 		ent = strlist__entry(rawlist, i);
 		parse_trace_kprobe_event(ent->s, &group, &event, NULL);
 		strlist__add(sl, event);
 		free(group);
+		free(event);
 	}
 
 	strlist__delete(rawlist);
@@ -480,5 +481,6 @@ void add_trace_kprobe_events(struct probe_point *probes, int nr_probes)
 			strlist__add(namelist, event);
 		}
 	}
+	strlist__delete(namelist);
 	close(fd);
 }

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

* [tip:perf/urgent] x86 insn: Delete empty or incomplete inat-tables.c
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 1/5] x86 insn: Delete empty or incomplete inat-tables.c Masami Hiramatsu
@ 2009-12-07 17:38   ` tip-bot for Masami Hiramatsu
  0 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Masami Hiramatsu @ 2009-12-07 17:38 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, jens.axboe, fweisbec, dle-develop,
	arekm, tglx, mhiramat, mingo, systemtap

Commit-ID:  d32ba45503acf9c23b301eba2397ca2ee322627b
Gitweb:     http://git.kernel.org/tip/d32ba45503acf9c23b301eba2397ca2ee322627b
Author:     Masami Hiramatsu <mhiramat@redhat.com>
AuthorDate: Mon, 7 Dec 2009 12:00:33 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 7 Dec 2009 18:33:19 +0100

x86 insn: Delete empty or incomplete inat-tables.c

Delete empty or incomplete inat-tables.c if gen-insn-attr-x86.awk
failed, because it causes a build error if user tries to build
kernel next time.

Reported-by: Arkadiusz Miskiewicz <arekm@maven.pl>
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20091207170033.19230.37688.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/lib/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 442b3b3..45b20e4 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -5,7 +5,7 @@
 inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk
 inat_tables_maps = $(srctree)/arch/x86/lib/x86-opcode-map.txt
 quiet_cmd_inat_tables = GEN     $@
-      cmd_inat_tables = $(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@
+      cmd_inat_tables = $(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@
 
 $(obj)/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
 	$(call cmd,inat_tables)

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

* [tip:perf/urgent] perf probe: Check e_snprintf() format string
  2009-12-07 16:56 ` [BUGFIX PATCH -tip 4/5] perf probe: Check e_snprintf() format string Masami Hiramatsu
@ 2009-12-07 17:39   ` tip-bot for Masami Hiramatsu
  0 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Masami Hiramatsu @ 2009-12-07 17:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, acme, hpa, mingo, dle-develop, fweisbec, tglx,
	mhiramat, mingo, systemtap

Commit-ID:  849884508ecbe2d220131840e4cc7c32ca24ebe3
Gitweb:     http://git.kernel.org/tip/849884508ecbe2d220131840e4cc7c32ca24ebe3
Author:     Masami Hiramatsu <mhiramat@redhat.com>
AuthorDate: Mon, 7 Dec 2009 12:00:53 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 7 Dec 2009 18:33:21 +0100

perf probe: Check e_snprintf() format string

Check e_snprintf() format string by gcc, and fix a bug of
e_snprintf() caller.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20091207170053.19230.7690.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/util/probe-event.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index de0d913..88e1804 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -48,6 +48,9 @@
 
 /* If there is no space to write, returns -E2BIG. */
 static int e_snprintf(char *str, size_t size, const char *format, ...)
+	__attribute__((format(printf, 3, 4)));
+
+static int e_snprintf(char *str, size_t size, const char *format, ...)
 {
 	int ret;
 	va_list ap;
@@ -258,7 +261,7 @@ int synthesize_perf_probe_event(struct probe_point *pp)
 		ret = e_snprintf(buf, MAX_CMDLEN, "%s%s%s%s", pp->function,
 				 offs, pp->retprobe ? "%return" : "", line);
 	else
-		ret = e_snprintf(buf, MAX_CMDLEN, "%s%s%s%s", pp->file, line);
+		ret = e_snprintf(buf, MAX_CMDLEN, "%s%s", pp->file, line);
 	if (ret <= 0)
 		goto error;
 	len = ret;

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

end of thread, other threads:[~2009-12-07 17:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-07 16:56 [BUGFIX PATCH -tip 0/5] perf-probe/x86 insn decoder bugfixes Masami Hiramatsu
2009-12-07 16:56 ` [BUGFIX PATCH -tip 4/5] perf probe: Check e_snprintf() format string Masami Hiramatsu
2009-12-07 17:39   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
2009-12-07 16:56 ` [BUGFIX PATCH -tip 2/5] perf probe: Fix strtailcmp() to compare s1[0] and s2[0] Masami Hiramatsu
2009-12-07 16:56 ` [BUGFIX PATCH -tip 5/5] perf probe: Use pr_debug for debug message Masami Hiramatsu
2009-12-07 17:38   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
2009-12-07 16:56 ` [BUGFIX PATCH -tip 3/5] perf probe: Fix event namelist to duplicate string Masami Hiramatsu
2009-12-07 17:38   ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
2009-12-07 16:56 ` [BUGFIX PATCH -tip 1/5] x86 insn: Delete empty or incomplete inat-tables.c Masami Hiramatsu
2009-12-07 17:38   ` [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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).