Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169829
b: refs/heads/master
c: ba8665d
h: refs/heads/master
i:
  169827: be21819
v: v3
  • Loading branch information
Masami Hiramatsu authored and Ingo Molnar committed Dec 1, 2009
1 parent c6226a2 commit 7e0231f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5cbd08056142dcb2aea0dca7261afcb810a63c55
refs/heads/master: ba8665d7dd95eb6093ee06f8f624b6acb1e73206
26 changes: 19 additions & 7 deletions trunk/kernel/trace/trace_kprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,8 @@ static int parse_probe_vars(char *arg, struct fetch_func *ff, int is_return)
return ret;
}

static int parse_probe_arg(char *arg, struct fetch_func *ff, int is_return)
/* Recursive argument parser */
static int __parse_probe_arg(char *arg, struct fetch_func *ff, int is_return)
{
int ret = 0;
unsigned long param;
Expand Down Expand Up @@ -543,7 +544,7 @@ static int parse_probe_arg(char *arg, struct fetch_func *ff, int is_return)
if (!id)
return -ENOMEM;
id->offset = offset;
ret = parse_probe_arg(arg, &id->orig, is_return);
ret = __parse_probe_arg(arg, &id->orig, is_return);
if (ret)
kfree(id);
else {
Expand All @@ -560,6 +561,16 @@ static int parse_probe_arg(char *arg, struct fetch_func *ff, int is_return)
return ret;
}

/* String length checking wrapper */
static int parse_probe_arg(char *arg, struct fetch_func *ff, int is_return)
{
if (strlen(arg) > MAX_ARGSTR_LEN) {
pr_info("Argument is too long.: %s\n", arg);
return -ENOSPC;
}
return __parse_probe_arg(arg, ff, is_return);
}

/* Return 1 if name is reserved or already used by another argument */
static int conflict_field_name(const char *name,
struct probe_arg *args, int narg)
Expand Down Expand Up @@ -698,13 +709,14 @@ static int create_trace_probe(int argc, char **argv)
}

tp->args[i].name = kstrdup(argv[i], GFP_KERNEL);

/* Parse fetch argument */
if (strlen(arg) > MAX_ARGSTR_LEN) {
pr_info("Argument%d(%s) is too long.\n", i, arg);
ret = -ENOSPC;
if (!tp->args[i].name) {
pr_info("Failed to allocate argument%d name '%s'.\n",
i, argv[i]);
ret = -ENOMEM;
goto error;
}

/* Parse fetch argument */
ret = parse_probe_arg(arg, &tp->args[i].fetch, is_return);
if (ret) {
pr_info("Parse error at argument%d. (%d)\n", i, ret);
Expand Down

0 comments on commit 7e0231f

Please sign in to comment.