[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LFD.1.10.0906041303510.332@ftp.linux-mips.org>
Date: Thu, 4 Jun 2009 13:04:23 +0100 (WEST)
From: "Maciej W. Rozycki" <macro@...ux-mips.org>
To: Roel Kluin <roel.kluin@...il.com>
cc: davem@...emloft.net, lkml <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
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@...il.com>
Acked-by: Maciej W. Rozycki <macro@...ux-mips.org>
Maciej
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists