[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BANLkTinn449JN_jAeO9M_AuZ1B2+7hgj4A@mail.gmail.com>
Date: Mon, 13 Jun 2011 13:06:26 -0400
From: Andrew Lutomirski <luto@....edu>
To: Rakib Mullick <rakib.mullick@...il.com>
Cc: Ingo Molnar <mingo@...e.hu>, hpa@...or.com, tglx@...utronix.de,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86, vsyscall: Fix build warning in vsyscall_64.c
On Mon, Jun 13, 2011 at 1:05 PM, Rakib Mullick <rakib.mullick@...il.com> wrote:
> On Mon, Jun 13, 2011 at 8:18 PM, Andrew Lutomirski <luto@....edu> wrote:
>> On Mon, Jun 13, 2011 at 10:14 AM, Ingo Molnar <mingo@...e.hu> wrote:
>>>
>>> * Andrew Lutomirski <luto@....edu> wrote:
>>>
>>>> On Mon, Jun 13, 2011 at 5:29 AM, Ingo Molnar <mingo@...e.hu> wrote:
>>>> >
>>>> > * Andrew Lutomirski <luto@....edu> wrote:
>>>> >
>>>> >> On Sat, Jun 11, 2011 at 3:31 AM, Rakib Mullick <rakib.mullick@...il.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.
>>
>> Fair enough.
>>
>> Unfortunately there doesn't seem to be an EKERNELBUG error code, and
>> initializing to EFAULT seems silly. 0 is probably harmless.
>>
>> I'll wait awhile longer for that GCC version, since there might be a
>> better fix. In any case, it would be nice for the changelog entry to
>> say which version has a warning that's being worked around.
>>
> Well, I think I already posted the GCC version in this thread. Anyway,
> for you're convenience, here is my GCC version: gcc version 4.5.1
> 20100924 (Red Hat 4.5.1-4). I'm using Fedora Core 14.
Sorry -- I think I managed to read every email in the thread except
that one. Will test tonight.
--Andy
>
>
> Thanks,
> Rakib
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists