[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1453851445-4645-1-git-send-email-colin.king@canonical.com>
Date: Tue, 26 Jan 2016 23:37:25 +0000
From: Colin King <colin.king@...onical.com>
To: James Hogan <james.hogan@...tec.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>, linux-metag@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] tty/metag_da: initialize number_written to zero
From: Colin Ian King <colin.king@...onical.com>
number_written is not initialized, so it can be any value. In the
case where dport->xmit_cnt is zero, number_written is not set
and subsequent accesses to it will be reading a garbage value.
Fix this by initializing it to zero for the case when
dport->xmit_count is zero.
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
drivers/tty/metag_da.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/metag_da.c b/drivers/tty/metag_da.c
index 9325262..3da89c1 100644
--- a/drivers/tty/metag_da.c
+++ b/drivers/tty/metag_da.c
@@ -230,7 +230,7 @@ static int put_channel_data(unsigned int chan)
{
struct dashtty_port *dport;
struct tty_struct *tty;
- int number_written;
+ int number_written = 0;
unsigned int count = 0;
dport = &dashtty_ports[chan];
--
2.7.0.rc3
Powered by blists - more mailing lists