aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2019-03-14 00:30:50 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2019-03-14 19:54:21 -0400
commita039480e9e93896cadc5a91468964febb3c5d488 (patch)
treeb0ae37b6ff3814566047f4cb8e5cac1d0738fc12
parent5b7a96220900e3c3f6fb53908eb4602cda959376 (diff)
tracing/probe: Verify alloc_trace_*probe() result
Since alloc_trace_*probe() returns -EINVAL only if !event && !group, it should not happen in trace_*probe_create(). If we catch that case there is a bug. So use WARN_ON_ONCE() instead of pr_info(). Link: http://lkml.kernel.org/r/155253785078.14922.16902223633734601469.stgit@devnote2 Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--kernel/trace/trace_kprobe.c4
-rw-r--r--kernel/trace/trace_uprobe.c3
2 files changed, 4 insertions, 3 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 5265117ad7e8..63aa0ab56051 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -693,9 +693,9 @@ static int trace_kprobe_create(int argc, const char *argv[])
693 tk = alloc_trace_kprobe(group, event, addr, symbol, offset, maxactive, 693 tk = alloc_trace_kprobe(group, event, addr, symbol, offset, maxactive,
694 argc, is_return); 694 argc, is_return);
695 if (IS_ERR(tk)) { 695 if (IS_ERR(tk)) {
696 pr_info("Failed to allocate trace_probe.(%d)\n",
697 (int)PTR_ERR(tk));
698 ret = PTR_ERR(tk); 696 ret = PTR_ERR(tk);
697 /* This must return -ENOMEM otherwise there is a bug */
698 WARN_ON_ONCE(ret != -ENOMEM);
699 goto out; 699 goto out;
700 } 700 }
701 701
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index 52f033489377..b54137ec7810 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -514,8 +514,9 @@ static int trace_uprobe_create(int argc, const char **argv)
514 514
515 tu = alloc_trace_uprobe(group, event, argc, is_return); 515 tu = alloc_trace_uprobe(group, event, argc, is_return);
516 if (IS_ERR(tu)) { 516 if (IS_ERR(tu)) {
517 pr_info("Failed to allocate trace_uprobe.(%d)\n", (int)PTR_ERR(tu));
518 ret = PTR_ERR(tu); 517 ret = PTR_ERR(tu);
518 /* This must return -ENOMEM otherwise there is a bug */
519 WARN_ON_ONCE(ret != -ENOMEM);
519 goto fail_address_parse; 520 goto fail_address_parse;
520 } 521 }
521 tu->offset = offset; 522 tu->offset = offset;