public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] tty: save newly allocated buffer in tty_free_termios()
@ 2012-07-20 13:32 Dan Carpenter
  2012-07-20 14:00 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-07-20 13:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Alan Cox; +Cc: linux-kernel, kernel-janitors

We're trying to save the termios state and we need to allocate a buffer
to do it.  Smatch complains that the buffer is leaked at the end of the
function.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index be18d60..58a1bdd 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1450,6 +1450,7 @@ void tty_free_termios(struct tty_struct *tty)
 			pr_warn("tty: no memory to save termios state.\n");
 			return;
 		}
+		tty->driver->termios[idx] = tp;
 	}
 	*tp = tty->termios;
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] tty: save newly allocated buffer in tty_free_termios()
  2012-07-20 13:32 [patch] tty: save newly allocated buffer in tty_free_termios() Dan Carpenter
@ 2012-07-20 14:00 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2012-07-20 14:00 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Greg Kroah-Hartman, linux-kernel, kernel-janitors

On Fri, 20 Jul 2012 16:32:45 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> We're trying to save the termios state and we need to allocate a buffer
> to do it.  Smatch complains that the buffer is leaked at the end of the
> function.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Alan Cox <alan@linux.intel.com>

(introduced in the recent patches so no need to go back into stable or
anywhere like that)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-20 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-20 13:32 [patch] tty: save newly allocated buffer in tty_free_termios() Dan Carpenter
2012-07-20 14:00 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox