[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090616160208.10041.85297.stgit@t61.ukuu.org.uk>
Date: Tue, 16 Jun 2009 17:02:15 +0100
From: Alan Cox <alan@...rguk.ukuu.org.uk>
To: torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: [PATCH 9/9] imx: Check for NULL pointer deref before calling
tty_encode_baud_rate
From: Sascha Hauer <s.hauer@...gutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@...gutronix.de>
Signed-off-by: Alan Cox <alan@...ux.intel.com>
---
drivers/serial/imx.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 285b414..5d7b58f 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -924,11 +924,13 @@ imx_set_termios(struct uart_port *port, struct ktermios *termios,
rational_best_approximation(16 * div * baud, sport->port.uartclk,
1 << 16, 1 << 16, &num, &denom);
- tdiv64 = sport->port.uartclk;
- tdiv64 *= num;
- do_div(tdiv64, denom * 16 * div);
- tty_encode_baud_rate(sport->port.info->port.tty,
- (speed_t)tdiv64, (speed_t)tdiv64);
+ if (port->info && port->info->port.tty) {
+ tdiv64 = sport->port.uartclk;
+ tdiv64 *= num;
+ do_div(tdiv64, denom * 16 * div);
+ tty_encode_baud_rate(sport->port.info->port.tty,
+ (speed_t)tdiv64, (speed_t)tdiv64);
+ }
num -= 1;
denom -= 1;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists