From: Steven Rostedt <rostedt@goodmis.org>
To: Qiaowei Ren <qiaowei.ren@intel.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel/trace: fix compiler warning
Date: Tue, 11 Feb 2014 11:03:48 -0500 [thread overview]
Message-ID: <20140211110348.492c47b4@gandalf.local.home> (raw)
In-Reply-To: <1392133301-17974-1-git-send-email-qiaowei.ren@intel.com>
On Tue, 11 Feb 2014 23:41:41 +0800
Qiaowei Ren <qiaowei.ren@intel.com> wrote:
> The patch fixes the following compiler warning:
> CC kernel/trace/trace_events.o
> kernel/trace/trace_events.c: In function 'event_enable_read'
> kernel/trace/trace_events.c:693: warning: 'flags' may be used \
> uninitialized in this function
You don't happen to have the branch profilers enabled?
Is CONFIG_TRACE_BRANCH_PROFILING set?
>
> Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
> ---
> kernel/trace/trace_events.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index e71ffd4..b7915f2 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -690,7 +690,7 @@ event_enable_read(struct file *filp, char __user *ubuf, size_t cnt,
> loff_t *ppos)
> {
> struct ftrace_event_file *file;
> - unsigned long flags;
> + unsigned long flags = 0;
> char buf[4] = "0";
>
> mutex_lock(&event_mutex);
False warning, and most likely because the branch profilers screw up
gcc's ability to figure these things out.
Here's the content of that function:
mutex_lock(&event_mutex);
file = event_file_data(filp);
if (likely(file))
flags = file->flags;
mutex_unlock(&event_mutex);
if (!file)
return -ENODEV;
if (flags & FTRACE_EVENT_FL_ENABLED &&
Pretty obvious that flags can not be used uninitialized. If you happen
to have BRANCH profiling enabled, you must ignore all the gcc "might be
used uninitialized" warnings. They are useless.
This is not a bug, sorry.
-- Steve
prev parent reply other threads:[~2014-02-11 16:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-11 15:41 Qiaowei Ren
2014-02-11 16:03 ` Steven Rostedt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140211110348.492c47b4@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=qiaowei.ren@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®