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

Commit 1a2c4b31 authored by Sascha Hauer's avatar Sascha Hauer Committed by Linus Torvalds
Browse files

imx: Check for NULL pointer deref before calling tty_encode_baud_rate

parent 0ccad870
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -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);

	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;