From: Steven Rostedt <rostedt@goodmis.org>
To: Zhengwang Ruan <ruan.zhengwang@gmail.com>
Cc: fweisbec@gmail.com, mingo@redhat.com,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] Trace: initialize variable to clear warning
Date: Tue, 28 Feb 2012 14:16:31 +0000 [thread overview]
Message-ID: <1330438591.25686.214.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1330420174-20537-1-git-send-email-ruan.zhengwang@gmail.com>
On Tue, 2012-02-28 at 17:09 +0800, Zhengwang Ruan wrote:
> GCC warns that 'page2' is used without being initialized previously before
> being used, this is to clear it.
>
This is a bug in gcc that's fixed in 4.6 and beyond. I don't want to
remove this warning because it will hide a real bug if page2 really does
become uninitialized. If 4.6 gives a warning here, then I'll fix it.
Note, we can't just initialize it here either, because it is initialized
in the code, and if it gets used later without that initialization then
it will break. No default will work.
Thanks,
-- Steve
> Signed-off-by: Zhengwang Ruan <ruan.zhengwang@gmail.com>
> ---
> kernel/trace/trace.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index a3f1bc5..47376ba 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -3694,7 +3694,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
> int nr_pages = 1;
> ssize_t written;
> void *page1;
> - void *page2;
> + void *uninitialized_var(page2);
> int offset;
> int size;
> int len;
next prev parent reply other threads:[~2012-02-28 14:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-28 9:09 [PATCH] Trace: initialize variable to clear warning Zhengwang Ruan
2012-02-28 10:27 ` Borislav Petkov
2012-02-28 14:16 ` Steven Rostedt [this message]
2012-02-29 22:40 ` Valdis.Kletnieks
2012-03-01 1:09 ` Steven Rostedt
2012-03-01 2:08 ` Zhengwang Ruan
2012-03-01 2:23 ` Valdis.Kletnieks
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=1330438591.25686.214.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=fweisbec@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=ruan.zhengwang@gmail.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