public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Alan Cox <alan@linux.intel.com>, Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Roland McGrath <roland@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -mm] signals-clear-signal-tty-when-the-last-thread-exits.fix
Date: Wed, 24 Mar 2010 07:41:49 -0400	[thread overview]
Message-ID: <20100324074149.8d4e96e6.akpm@linux-foundation.org> (raw)
In-Reply-To: <20100324142348.GA8117@redhat.com>

On Wed, 24 Mar 2010 15:23:48 +0100 Oleg Nesterov <oleg@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@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').


  reply	other threads:[~2010-03-24 14:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-19 18:40 [PATCH 2/3] clear signal->tty when the last thread exits Oleg Nesterov
2010-03-24 14:23 ` [PATCH -mm] signals-clear-signal-tty-when-the-last-thread-exits.fix Oleg Nesterov
2010-03-24 11:41   ` Andrew Morton [this message]
2010-03-24 16:02     ` Oleg Nesterov
2010-03-24 16:42       ` Oleg Nesterov
2010-04-08  2:20 ` [PATCH 2/3] clear signal->tty when the last thread exits Roland McGrath

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=20100324074149.8d4e96e6.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=roland@redhat.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