diff options
Diffstat (limited to 'kernel/trace/trace_kprobe.c')
-rw-r--r-- | kernel/trace/trace_kprobe.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index 0116c038b0bc..a39251ef1a7b 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c | |||
@@ -997,15 +997,18 @@ static int create_trace_probe(int argc, char **argv) | |||
997 | 997 | ||
998 | /* Parse argument name */ | 998 | /* Parse argument name */ |
999 | arg = strchr(argv[i], '='); | 999 | arg = strchr(argv[i], '='); |
1000 | if (arg) | 1000 | if (arg) { |
1001 | *arg++ = '\0'; | 1001 | *arg++ = '\0'; |
1002 | else | 1002 | tp->args[i].name = kstrdup(argv[i], GFP_KERNEL); |
1003 | } else { | ||
1003 | arg = argv[i]; | 1004 | arg = argv[i]; |
1005 | /* If argument name is omitted, set "argN" */ | ||
1006 | snprintf(buf, MAX_EVENT_NAME_LEN, "arg%d", i + 1); | ||
1007 | tp->args[i].name = kstrdup(buf, GFP_KERNEL); | ||
1008 | } | ||
1004 | 1009 | ||
1005 | tp->args[i].name = kstrdup(argv[i], GFP_KERNEL); | ||
1006 | if (!tp->args[i].name) { | 1010 | if (!tp->args[i].name) { |
1007 | pr_info("Failed to allocate argument%d name '%s'.\n", | 1011 | pr_info("Failed to allocate argument[%d] name.\n", i); |
1008 | i, argv[i]); | ||
1009 | ret = -ENOMEM; | 1012 | ret = -ENOMEM; |
1010 | goto error; | 1013 | goto error; |
1011 | } | 1014 | } |
@@ -1014,7 +1017,7 @@ static int create_trace_probe(int argc, char **argv) | |||
1014 | *tmp = '_'; /* convert : to _ */ | 1017 | *tmp = '_'; /* convert : to _ */ |
1015 | 1018 | ||
1016 | if (conflict_field_name(tp->args[i].name, tp->args, i)) { | 1019 | if (conflict_field_name(tp->args[i].name, tp->args, i)) { |
1017 | pr_info("Argument%d name '%s' conflicts with " | 1020 | pr_info("Argument[%d] name '%s' conflicts with " |
1018 | "another field.\n", i, argv[i]); | 1021 | "another field.\n", i, argv[i]); |
1019 | ret = -EINVAL; | 1022 | ret = -EINVAL; |
1020 | goto error; | 1023 | goto error; |
@@ -1023,7 +1026,7 @@ static int create_trace_probe(int argc, char **argv) | |||
1023 | /* Parse fetch argument */ | 1026 | /* Parse fetch argument */ |
1024 | ret = parse_probe_arg(arg, tp, &tp->args[i], is_return); | 1027 | ret = parse_probe_arg(arg, tp, &tp->args[i], is_return); |
1025 | if (ret) { | 1028 | if (ret) { |
1026 | pr_info("Parse error at argument%d. (%d)\n", i, ret); | 1029 | pr_info("Parse error at argument[%d]. (%d)\n", i, ret); |
1027 | goto error; | 1030 | goto error; |
1028 | } | 1031 | } |
1029 | } | 1032 | } |