aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2018-07-25 22:28:56 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2018-07-25 22:33:50 -0400
commit2519c1bbe38d7acacc9aacba303ca6f97482ed53 (patch)
tree6d60632f0a1cbd4fb9a9c79462e6a0887bd4c19a
parent15cc78644d0075e76d59476a4467e7143860f660 (diff)
tracing: Quiet gcc warning about maybe unused link variable
Commit 57ea2a34adf4 ("tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure") added an if statement that depends on another if statement that gcc doesn't see will initialize the "link" variable and gives the warning: "warning: 'link' may be used uninitialized in this function" It is really a false positive, but to quiet the warning, and also to make sure that it never actually is used uninitialized, initialize the "link" variable to NULL and add an if (!WARN_ON_ONCE(!link)) where the compiler thinks it could be used uninitialized. Cc: stable@vger.kernel.org Fixes: 57ea2a34adf4 ("tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure") Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--kernel/trace/trace_kprobe.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 27ace4513c43..6b71860f3998 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -400,7 +400,7 @@ static struct trace_kprobe *find_trace_kprobe(const char *event,
400static int 400static int
401enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file) 401enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
402{ 402{
403 struct event_file_link *link; 403 struct event_file_link *link = NULL;
404 int ret = 0; 404 int ret = 0;
405 405
406 if (file) { 406 if (file) {
@@ -426,7 +426,9 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
426 426
427 if (ret) { 427 if (ret) {
428 if (file) { 428 if (file) {
429 list_del_rcu(&link->list); 429 /* Notice the if is true on not WARN() */
430 if (!WARN_ON_ONCE(!link))
431 list_del_rcu(&link->list);
430 kfree(link); 432 kfree(link);
431 tk->tp.flags &= ~TP_FLAG_TRACE; 433 tk->tp.flags &= ~TP_FLAG_TRACE;
432 } else { 434 } else {