Prev: [PATCH -mm] signals-clear-signal-tty-when-the-last-thread-exits.fix
Next: move_task_off_dead_cpu: take rq->lock around select_fallback_rq()
From: Andrew Morton on 24 Mar 2010 10:50 On Wed, 24 Mar 2010 15:23:48 +0100 Oleg Nesterov <oleg(a)redhat.com> wrote: > (fixup for signals-clear-signal-tty-when-the-last-thread-exits.patch) > > I didn't get this warning, but the old gcc complains > > kernel/exit.c: In function 'release_task': > kernel/exit.c:85: warning: 'tty' may be used uninitialized in this function > > This clearly wrong, to the point it blames release_task() instead of > __exit_signal(). But let's make compiler happy anyway, hopefully this > is what it wants. > > Signed-off-by: Oleg Nesterov <oleg(a)redhat.com> > --- > > kernel/exit.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > --- 34-rc1/kernel/exit.c~FIX_EXIT_SIGNAL_TTY_WARNING 2010-03-21 18:36:44.000000000 +0100 > +++ 34-rc1/kernel/exit.c 2010-03-24 14:59:55.000000000 +0100 > @@ -82,7 +82,7 @@ static void __exit_signal(struct task_st > struct signal_struct *sig = tsk->signal; > bool group_dead = thread_group_leader(tsk); > struct sighand_struct *sighand; > - struct tty_struct *tty; > + struct tty_struct *tty = NULL; /* supress gcc warning */ uninitialized_var() is a neater way. (uninitialized_var() will save a teeny bit of .text on old gcc. One suspects that a newer gcc which is capable of working out that this variable _isn't_ uninitialized would also be capable of eliding the `= 0'). -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Oleg Nesterov on 24 Mar 2010 12:10 On 03/24, Andrew Morton wrote: > > > - struct tty_struct *tty; > > + struct tty_struct *tty = NULL; /* supress gcc warning */ > > uninitialized_var() is a neater way. Aha, indeed. Will resend soon... Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Oleg Nesterov on 24 Mar 2010 12:50
I didn't get this warning, but the old gcc complains kernel/exit.c: In function 'release_task': kernel/exit.c:85: warning: 'tty' may be used uninitialized in this function This clearly wrong, to the point it blames release_task() instead of __exit_signal(). But let's make compiler happy anyway. Thanks Andrew, now I know we have the handy uninitialized_var() helper ;) Signed-off-by: Oleg Nesterov <oleg(a)redhat.com> --- kernel/exit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 34-rc1/kernel/exit.c~FIX_EXIT_SIGNAL_TTY_WARNING 2010-03-21 18:36:44.000000000 +0100 +++ 34-rc1/kernel/exit.c 2010-03-24 17:36:32.000000000 +0100 @@ -82,7 +82,7 @@ static void __exit_signal(struct task_st struct signal_struct *sig = tsk->signal; bool group_dead = thread_group_leader(tsk); struct sighand_struct *sighand; - struct tty_struct *tty; + struct tty_struct *uninitialized_var(tty); BUG_ON(!sig); BUG_ON(!atomic_read(&sig->count)); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |