diff options
author | Roel Kluin <[email protected]> | 2009-06-22 18:41:56 +0100 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2009-06-22 11:32:23 -0700 |
commit | 52e3632ea603ef92757d5d0dedcd9fc8643445e3 (patch) | |
tree | 8ab96a99d898ada201b55ccb30fe7c0e6a10170f /net/lapb/lapb_subr.c | |
parent | 607c268ef9a4675287e77f732071e426e62c2d86 (diff) |
serial: fix off by one errors
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 <[email protected]>
Acked-by: David S. Miller <[email protected]>
Acked-by: Maciej W. Rozycki <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'net/lapb/lapb_subr.c')
0 files changed, 0 insertions, 0 deletions