Re: [PATCH] x86-64: add default case to emulate_vsyscall() to silencecompiler warning

From: Andrew Lutomirski
Date: Thu Sep 15 2011 - 10:49:32 EST


On Thu, Sep 15, 2011 at 1:38 AM, Jan Beulich <JBeulich@xxxxxxxx> wrote:
> ... since the compiler can't possibly know that vsyscall_nr is limited
> to three values, and hence 'ret' must appear possibly uninitialized to
> it.

Hmm. I actually wrote that thing carefully to avoid needing a default
case. My copy of gcc (Red Hat 4.6.0-10) doesn't warn.

I guess that older versions do warn. I have no strong preference on
what to do avoid it.

--Andy

>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
> Cc: Andy Lutomirski <luto@xxxxxxx>
>
> ---
>  arch/x86/kernel/vsyscall_64.c |    3 +++
>  1 file changed, 3 insertions(+)
>
> --- 3.1-rc6/arch/x86/kernel/vsyscall_64.c
> +++ 3.1-rc6-x86_64-emul-vsyscall/arch/x86/kernel/vsyscall_64.c
> @@ -195,6 +195,9 @@ bool emulate_vsyscall(struct pt_regs *re
>                                 (unsigned __user *)regs->si,
>                                 0);
>                break;
> +       default:
> +               ret = -ENOSYS;
> +               break;
>        }
>
>        if (ret == -EFAULT) {
>
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/