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

Commit c904375d authored by Frans Klaver's avatar Frans Klaver Committed by Greg Kroah-Hartman
Browse files

serial: 8250_core: actually limit char reads to max_count



In serial8250_rx_chars(), max_count is set to 256. Due to the
post-decrement operator used in the while() condition, the maximum
number of iterations actually 257. This is not a problem, but it is
mildly surprising if you're debugging. Use pre-decrement instead.

Signed-off-by: default avatarFrans Klaver <frans.klaver@xsens.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8a8ae62f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1501,7 +1501,7 @@ serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr)

ignore_char:
		lsr = serial_in(up, UART_LSR);
	} while ((lsr & (UART_LSR_DR | UART_LSR_BI)) && (max_count-- > 0));
	} while ((lsr & (UART_LSR_DR | UART_LSR_BI)) && (--max_count > 0));
	spin_unlock(&port->lock);
	tty_flip_buffer_push(&port->state->port);
	spin_lock(&port->lock);