From: Masami Hiramatsu <mhiramat@redhat.com>
To: Ingo Molnar <mingo@elte.hu>,
Frederic Weisbecker <fweisbec@gmail.com>,
lkml<linux-kernel@vger.kernel.org>
Cc: systemtap<systemtap@sources.redhat.com>,
DLE<dle-develop@lists.sourceforge.net>,
Masami Hiramatsu <mhiramat@redhat.com>,
Ingo Molnar <mingo@elte.hu>,
Frederic Weisbecker <fweisbec@gmail.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [BUGFIX PATCH -tip 4/5] perf probe: Check e_snprintf() format string
Date: Mon, 07 Dec 2009 16:56:00 -0000 [thread overview]
Message-ID: <20091207170053.19230.7690.stgit@dhcp-100-2-132.bos.redhat.com> (raw)
In-Reply-To: <20091207170027.19230.39491.stgit@dhcp-100-2-132.bos.redhat.com>
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
next prev parent reply other threads:[~2009-12-07 16:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 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
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 [this message]
2009-12-07 17:39 ` [tip:perf/urgent] perf probe: Check e_snprintf() format string tip-bot for 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091207170053.19230.7690.stgit@dhcp-100-2-132.bos.redhat.com \
--to=mhiramat@redhat.com \
--cc=acme@redhat.com \
--cc=dle-develop@lists.sourceforge.net \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=systemtap@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).