From: Ingo Molnar <mingo@elte.hu>
To: Andrew Lutomirski <luto@mit.edu>
Cc: Rakib Mullick <rakib.mullick@gmail.com>,
hpa@zytor.com, tglx@linutronix.de, x86@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86, vsyscall: Fix build warning in vsyscall_64.c
Date: Mon, 13 Jun 2011 16:14:08 +0200 [thread overview]
Message-ID: <20110613141408.GA16126@elte.hu> (raw)
In-Reply-To: <BANLkTi=eLODKcTfXb8Z1eAy4KnSE16icow@mail.gmail.com>
* Andrew Lutomirski <luto@mit.edu> wrote:
> On Mon, Jun 13, 2011 at 5:29 AM, Ingo Molnar <mingo@elte.hu> wrote:
> >
> > * Andrew Lutomirski <luto@mit.edu> wrote:
> >
> >> On Sat, Jun 11, 2011 at 3:31 AM, Rakib Mullick <rakib.mullick@gmail.com> wrote:
> >> > Due to commit 5cec93c216db77 (x86-64: Emulate legacy vsyscalls), we get the following warning:
> >> >
> >> > arch/x86/kernel/vsyscall_64.c: In function ‘do_emulate_vsyscall’:
> >> > arch/x86/kernel/vsyscall_64.c:111:7: warning: ‘ret’ may be used uninitialized in this function
> >>
> >> What's the code path that uses ret without initializing it?
> >
> > If the code is correct but GCC got confused then please use the
> > simplest possible patch to help GCC find its way around the code.
>
> The simplest patch is to mark ret as uninitialized_var.
No - that primitive really sucks as it might hide *future* debug
warnings and silently break code.
The problem with uninitialized_var() is that such code:
int test(void)
{
int uninitialized_var(ret);
return ret;
}
Builds without a single warning but it is very broken code.
So if we use uninitialized_var() and the code is changed in the
future to have the above broken sequence, we'll have a silent runtime
failure ...
So we try to avoid using uninitialized_var() in arch/x86/ and use
explicit initialization instead.
That way GCC that can see through the flow will optimize away the
superfluous initialization - GCC versions that are older will
generate one more instruction but that's OK.
Thanks,
Ingo
next prev parent reply other threads:[~2011-06-13 14:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-11 7:31 [PATCH] x86, vsyscall: Fix build warning in vsyscall_64.c Rakib Mullick
2011-06-11 11:01 ` Andrew Lutomirski
2011-06-12 5:12 ` Rakib Mullick
2011-06-13 2:52 ` Andrew Lutomirski
2011-06-13 4:54 ` Rakib Mullick
2011-06-13 8:45 ` Rakib Mullick
2011-06-13 18:06 ` Andrew Lutomirski
2011-06-14 17:43 ` Rakib Mullick
2011-06-14 18:03 ` Andy Lutomirski
2011-06-14 21:16 ` Ingo Molnar
2011-06-14 21:24 ` Linus Torvalds
2011-06-14 21:31 ` Ingo Molnar
2011-06-14 21:33 ` Andrew Lutomirski
2011-06-15 5:59 ` Rakib Mullick
2011-06-15 7:25 ` Ingo Molnar
2011-06-15 18:49 ` Linus Torvalds
2011-06-15 19:24 ` Andrew Lutomirski
2011-06-15 19:32 ` Linus Torvalds
2011-06-15 19:51 ` Andrew Lutomirski
2011-06-13 9:29 ` Ingo Molnar
2011-06-13 13:03 ` Andrew Lutomirski
2011-06-13 14:14 ` Ingo Molnar [this message]
2011-06-13 14:18 ` Andrew Lutomirski
2011-06-13 17:05 ` Rakib Mullick
2011-06-13 17:06 ` Andrew Lutomirski
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=20110613141408.GA16126@elte.hu \
--to=mingo@elte.hu \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@mit.edu \
--cc=rakib.mullick@gmail.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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