summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2018-07-25 22:28:56 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-08-09 12:20:25 +0200
commit490106d9760e34ec0f85139e8ec900f2aa6974e9 (patch)
tree24cd0b49d97bb312268ae77130fd8315a6df3a3c /kernel
parent15165b72aa41f623e1519e03e5e1de9ee92cad73 (diff)
downloadlinux-stable-490106d9760e34ec0f85139e8ec900f2aa6974e9.tar.gz
linux-stable-490106d9760e34ec0f85139e8ec900f2aa6974e9.tar.bz2
linux-stable-490106d9760e34ec0f85139e8ec900f2aa6974e9.zip
tracing: Quiet gcc warning about maybe unused link variable
commit 2519c1bbe38d7acacc9aacba303ca6f97482ed53 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-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 669609756720..e052395ba83a 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -361,7 +361,7 @@ static struct trace_kprobe *find_trace_kprobe(const char *event,
static int
enable_trace_kprobe(struct trace_kprobe *tk, struct ftrace_event_file *file)
{
- struct event_file_link *link;
+ struct event_file_link *link = NULL;
int ret = 0;
if (file) {
@@ -387,7 +387,9 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct ftrace_event_file *file)
if (ret) {
if (file) {
- list_del_rcu(&link->list);
+ /* Notice the if is true on not WARN() */
+ if (!WARN_ON_ONCE(!link))
+ list_del_rcu(&link->list);
kfree(link);
tk->tp.flags &= ~TP_FLAG_TRACE;
} else {