summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrans Klaver <frans.klaver@xsens.com>2014-11-06 21:10:17 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-06 15:01:03 -0800
commitc904375d4b15122c225c1073fd7a56bd541b0ce5 (patch)
treec552144cfd34a05428db130e6ceffe2431ec78a5
parent8a8ae62f8296760a2a1eee7009a1444c327603e0 (diff)
downloadlinux-c904375d4b15122c225c1073fd7a56bd541b0ce5.tar.bz2
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: Frans Klaver <frans.klaver@xsens.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/8250/8250_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 30522d680014..d0d0c3b6af02 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -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);