Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0ab0236 authored by Wei Yongjun's avatar Wei Yongjun Committed by Greg Kroah-Hartman
Browse files

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: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 218cbbd8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);