Messages in this thread |  | | | Date | Thu, 4 Jun 2009 13:04:23 +0100 (WEST) | | From | "Maciej W. Rozycki" <> | | Subject | Re: [PATCH] serial: off by one |
| |
On Thu, 4 Jun 2009, Roel Kluin wrote:
> In zs_console_putchar() occurs: > > if (zs_transmit_drain(zport, irq)) > write_zsdata(zport, ch); > > However if in zs_transmit_drain() no empty Tx Buffer occurs, limit reaches > -1 => true, and the write still occurs. > > This patch changes postfix to prefix decrements in this and similar > functions to prevent similar mistakes in the future. This decreases the > iterations with one but the chosen loop count was arbitrary anyway. > > In sunhv limit reaches -1, not 0, so the test is off by one. > > Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Maciej W. Rozycki <macro@linux-mips.org>
Maciej
|  |