summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2012-11-29 06:30:01 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-30 06:15:27 +0400
commitb0ab02361167faa82198b783a8d555eb6f58901c (patch)
tree85e0f71610c6db1dc2fbcbe5cea2fb40332920b0 /drivers
parent218cbbd82132d48c6f4e042e31beb6019f92db01 (diff)
downloadlinux-b0ab02361167faa82198b783a8d555eb6f58901c.tar.xz
staging: sb105x: fix potential NULL pointer dereference in mp_chars_in_buffer()
The dereference to 'state' should be moved below the NULL test. Cc: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/sb105x/sb_pci_mp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/staging/sb105x/sb_pci_mp.c b/drivers/staging/sb105x/sb_pci_mp.c
index fbebf88226d3..edb2a85b9d52 100644
--- a/drivers/staging/sb105x/sb_pci_mp.c
+++ b/drivers/staging/sb105x/sb_pci_mp.c
@@ -689,13 +689,14 @@ static int mp_chars_in_buffer(struct tty_struct *tty)
static void mp_flush_buffer(struct tty_struct *tty)
{
struct sb_uart_state *state = tty->driver_data;
- struct sb_uart_port *port = state->port;
+ struct sb_uart_port *port;
unsigned long flags;
if (!state || !state->info) {
return;
}
+ port = state->port;
spin_lock_irqsave(&port->lock, flags);
uart_circ_clear(&state->info->xmit);
spin_unlock_irqrestore(&port->lock, flags);