[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090603.211823.192890836.davem@davemloft.net>
Date: Wed, 03 Jun 2009 21:18:23 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: roel.kluin@...il.com
Cc: macro@...ux-mips.org, linux-kernel@...r.kernel.org,
akpm@...ux-foundation.org
Subject: Re: [PATCH] serial: off by one
From: Roel Kluin <roel.kluin@...il.com>
Date: Thu, 04 Jun 2009 01:20:33 +0200
> 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: David S. Miller <davem@...emloft.net>
--
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