aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-probe.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2009-11-30 19:19:43 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-01 02:20:01 -0500
commit74ca4c0ece52a2d19dae1bcbfc24fcfc5facfeb4 (patch)
treece2924790106487beab8a714c54ecf171539422f /tools/perf/builtin-probe.c
parent57d250df7deb3e1742fbf3cc3230119731109552 (diff)
perf probe: Fix argv array size in probe parser
Since the syntax has been changed, probe definition needs parameters less than MAX_PROBE_ARGS + 1 (probe-point + arguments). Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Cc: systemtap <systemtap@sources.redhat.com> Cc: DLE <dle-develop@lists.sourceforge.net> 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: Frank Ch. Eigler <fche@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> 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: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <20091201001943.10235.80367.stgit@harusame> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-probe.c')
-rw-r--r--tools/perf/builtin-probe.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 4e418afd6705..510fdd4e5d37 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -151,7 +151,7 @@ static void parse_probe_point(char *arg, struct probe_point *pp)
151/* Parse an event definition. Note that any error must die. */ 151/* Parse an event definition. Note that any error must die. */
152static void parse_probe_event(const char *str) 152static void parse_probe_event(const char *str)
153{ 153{
154 char *argv[MAX_PROBE_ARGS + 2]; /* Event + probe + args */ 154 char *argv[MAX_PROBE_ARGS + 1]; /* probe + args */
155 int argc, i; 155 int argc, i;
156 struct probe_point *pp = &session.probes[session.nr_probe]; 156 struct probe_point *pp = &session.probes[session.nr_probe];
157 157
@@ -169,6 +169,9 @@ static void parse_probe_event(const char *str)
169 /* Add an argument */ 169 /* Add an argument */
170 if (*str != '\0') { 170 if (*str != '\0') {
171 const char *s = str; 171 const char *s = str;
172 /* Check the limit number of arguments */
173 if (argc == MAX_PROBE_ARGS + 1)
174 semantic_error("Too many arguments");
172 175
173 /* Skip the argument */ 176 /* Skip the argument */
174 while (!isspace(*str) && *str != '\0') 177 while (!isspace(*str) && *str != '\0')
@@ -178,9 +181,9 @@ static void parse_probe_event(const char *str)
178 argv[argc] = strndup(s, str - s); 181 argv[argc] = strndup(s, str - s);
179 if (argv[argc] == NULL) 182 if (argv[argc] == NULL)
180 die("strndup"); 183 die("strndup");
181 if (++argc == MAX_PROBE_ARGS) 184 pr_debug("argv[%d]=%s\n", argc, argv[argc]);
182 semantic_error("Too many arguments"); 185 argc++;
183 pr_debug("argv[%d]=%s\n", argc, argv[argc - 1]); 186
184 } 187 }
185 } while (*str != '\0'); 188 } while (*str != '\0');
186 if (!argc) 189 if (!argc)