From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH 9/9] imx: Check for NULL pointer deref before calling tty_encode_baud_rate
Date: Tue, 16 Jun 2009 17:02:15 +0100 [thread overview]
Message-ID: <20090616160208.10041.85297.stgit@t61.ukuu.org.uk> (raw)
In-Reply-To: <20090616155552.10041.63479.stgit@t61.ukuu.org.uk>
From: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Alan Cox <alan@linux.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;
prev parent reply other threads:[~2009-06-16 15:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-16 15:59 [PATCH 0/9] Series short description Alan Cox
2009-06-16 16:00 ` [PATCH 1/9] tty: Fix leaks introduced by the shift to separate ldisc objects Alan Cox
2009-06-16 16:00 ` [PATCH 2/9] ldisc: Make sure the ldisc isn't active when we close it Alan Cox
2009-06-16 16:00 ` [PATCH 3/9] ldisc: debug aids Alan Cox
2009-06-16 16:01 ` [PATCH 4/9] tty: fix unused warning when TCGETX is not defined Alan Cox
2009-06-16 16:01 ` [PATCH 5/9] pty: Narrow the race on ldisc locking Alan Cox
2009-06-16 16:01 ` [PATCH 6/9] tty: fix sanity check Alan Cox
2009-06-16 16:01 ` [PATCH 7/9] MAINTAINERS: update 8250 section, give Alan Cox a name Alan Cox
2009-06-16 16:02 ` [PATCH 8/9] atmel_serial: fix hang in set_termios when crtscts is enabled Alan Cox
2009-06-16 16:02 ` Alan Cox [this message]
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=20090616160208.10041.85297.stgit@t61.ukuu.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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
all inboxes | Powered by JetHome®