aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)