From: tip-bot for Masami Hiramatsu <mhiramat@redhat.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, mingo@redhat.com, peterz@infradead.org,
dle-develop@lists.sourceforge.net, fweisbec@gmail.com,
rostedt@goodmis.org, jbaron@redhat.com, tglx@linutronix.de,
mhiramat@redhat.com, systemtap@sources.redhat.com,
linux-kernel@vger.kernel.org, hpa@zytor.com, paulus@samba.org,
jkenisto@us.ibm.com, hch@infradead.org, ananth@in.ibm.com,
srikar@linux.vnet.ibm.com, mingo@elte.hu,
prasad@linux.vnet.ibm.com
Subject: [tip:perf/urgent] perf probe: Check new event name
Date: Thu, 17 Dec 2009 10:52:03 GMT [thread overview]
Message-ID: <tip-b7702a2136b5f8e0e186e22cae91aaecf98b418c@git.kernel.org> (raw)
In-Reply-To: <20091216222415.14459.71383.stgit@dhcp-100-2-132.bos.redhat.com>
Commit-ID: b7702a2136b5f8e0e186e22cae91aaecf98b418c
Gitweb: http://git.kernel.org/tip/b7702a2136b5f8e0e186e22cae91aaecf98b418c
Author: Masami Hiramatsu <mhiramat@redhat.com>
AuthorDate: Wed, 16 Dec 2009 17:24:15 -0500
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 17 Dec 2009 09:42:44 +0100
perf probe: Check new event name
Check new event name is same syntax as a C symbol in perf command.
In other words, checking the name is as like as other tracepoint
events.
This can prevent user to create an event with useless name (e.g.
foo|bar, foo*bar).
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Jim Keniston <jkenisto@us.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Jason Baron <jbaron@redhat.com>
Cc: K.Prasad <prasad@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
LKML-Reference: <20091216222415.14459.71383.stgit@dhcp-100-2-132.bos.redhat.com>
[ v2: minor cleanups ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
tools/perf/util/probe-event.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 2ca6215..29465d4 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -62,6 +62,18 @@ static int e_snprintf(char *str, size_t size, const char *format, ...)
return ret;
}
+/* Check the name is good for event/group */
+static bool check_event_name(const char *name)
+{
+ if (!isalpha(*name) && *name != '_')
+ return false;
+ while (*++name != '\0') {
+ if (!isalpha(*name) && !isdigit(*name) && *name != '_')
+ return false;
+ }
+ return true;
+}
+
/* Parse probepoint definition. */
static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp)
{
@@ -82,6 +94,9 @@ static void parse_perf_probe_probepoint(char *arg, struct probe_point *pp)
ptr = strchr(arg, ':');
if (ptr) /* Group name is not supported yet. */
semantic_error("Group name is not supported yet.");
+ if (!check_event_name(arg))
+ semantic_error("%s is bad for event name -it must "
+ "follow C symbol-naming rule.", arg);
pp->event = strdup(arg);
arg = tmp;
}
prev parent reply other threads:[~2009-12-17 10:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-16 22:23 [PATCH -tip 0/3] perf/trace: bugfixes Masami Hiramatsu
2009-12-16 22:24 ` [PATCH -tip 1/3] perf probe: Check debugpath is correct Masami Hiramatsu
2009-12-17 10:51 ` [tip:perf/urgent] perf probe: Check whether debugfs path " tip-bot for Masami Hiramatsu
2009-12-16 22:24 ` [PATCH -tip 2/3] kprobe-tracer: Check new event/group name Masami Hiramatsu
2009-12-17 10:51 ` [tip:perf/urgent] " tip-bot for Masami Hiramatsu
2009-12-16 22:24 ` [PATCH -tip 3/3] perf probe: Check new event name Masami Hiramatsu
2009-12-17 10:52 ` tip-bot for Masami Hiramatsu [this message]
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=tip-b7702a2136b5f8e0e186e22cae91aaecf98b418c@git.kernel.org \
--to=mhiramat@redhat.com \
--cc=acme@redhat.com \
--cc=ananth@in.ibm.com \
--cc=dle-develop@lists.sourceforge.net \
--cc=fweisbec@gmail.com \
--cc=hch@infradead.org \
--cc=hpa@zytor.com \
--cc=jbaron@redhat.com \
--cc=jkenisto@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=prasad@linux.vnet.ibm.com \
--cc=rostedt@goodmis.org \
--cc=srikar@linux.vnet.ibm.com \
--cc=systemtap@sources.redhat.com \
--cc=tglx@linutronix.de \
/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