Skip to content

Commit a039480

Browse files
mhiramatrostedt
authored andcommitted
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>
1 parent 5b7a962 commit a039480

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

kernel/trace/trace_kprobe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,9 +693,9 @@ static int trace_kprobe_create(int argc, const char *argv[])
693693
tk = alloc_trace_kprobe(group, event, addr, symbol, offset, maxactive,
694694
argc, is_return);
695695
if (IS_ERR(tk)) {
696-
pr_info("Failed to allocate trace_probe.(%d)\n",
697-
(int)PTR_ERR(tk));
698696
ret = PTR_ERR(tk);
697+
/* This must return -ENOMEM otherwise there is a bug */
698+
WARN_ON_ONCE(ret != -ENOMEM);
699699
goto out;
700700
}
701701

kernel/trace/trace_uprobe.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,9 @@ static int trace_uprobe_create(int argc, const char **argv)
514514

515515
tu = alloc_trace_uprobe(group, event, argc, is_return);
516516
if (IS_ERR(tu)) {
517-
pr_info("Failed to allocate trace_uprobe.(%d)\n", (int)PTR_ERR(tu));
518517
ret = PTR_ERR(tu);
518+
/* This must return -ENOMEM otherwise there is a bug */
519+
WARN_ON_ONCE(ret != -ENOMEM);
519520
goto fail_address_parse;
520521
}
521522
tu->offset = offset;

0 commit comments

Comments
 (0)