2013-10-11 20:09:06

by Roel Kluin

[permalink] [raw]
Subject: tty: incorrect test of echo_buf() result for ECHO_OP_START

Untested, but this looks like a bug to me
-----------
test echo_buf() result for ECHO_OP_START

Signed-off-by: Roel Kluin <[email protected]>
---
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 7a744b6..42b6cca 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -767,7 +767,7 @@ static size_t __process_echoes(struct tty_struct *tty)
* of echo overrun before the next commit), then discard enough
* data at the tail to prevent a subsequent overrun */
while (ldata->echo_commit - tail >= ECHO_DISCARD_WATERMARK) {
- if (echo_buf(ldata, tail == ECHO_OP_START)) {
+ if (echo_buf(ldata, tail) == ECHO_OP_START) {
if (echo_buf(ldata, tail) == ECHO_OP_ERASE_TAB)
tail += 3;
else


2013-10-11 22:16:56

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: tty: incorrect test of echo_buf() result for ECHO_OP_START

On Sat, Oct 12, 2013 at 12:04:50AM +0200, Roel Kluin wrote:
> Adding Andrew to CC, thanks for comments & picking up my patches, BTW.

Given that Jiri and I are the tty/serial maintainers, we should be able
to handle this, give us a few days to catch up with patches sent before
yours...

thanks,

greg k-h

2013-10-11 22:47:43

by Peter Hurley

[permalink] [raw]
Subject: Re: tty: incorrect test of echo_buf() result for ECHO_OP_START

On 10/11/2013 04:08 PM, Roel Kluin wrote:
> Untested, but this looks like a bug to me

Careless error on my part. Fix looks good; thanks for catching this.

Regards,
Peter Hurley

> -----------
> test echo_buf() result for ECHO_OP_START
>
> Signed-off-by: Roel Kluin <[email protected]>
> ---
> diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
> index 7a744b6..42b6cca 100644
> --- a/drivers/tty/n_tty.c
> +++ b/drivers/tty/n_tty.c
> @@ -767,7 +767,7 @@ static size_t __process_echoes(struct tty_struct *tty)
> * of echo overrun before the next commit), then discard enough
> * data at the tail to prevent a subsequent overrun */
> while (ldata->echo_commit - tail >= ECHO_DISCARD_WATERMARK) {
> - if (echo_buf(ldata, tail == ECHO_OP_START)) {
> + if (echo_buf(ldata, tail) == ECHO_OP_START) {
> if (echo_buf(ldata, tail) == ECHO_OP_ERASE_TAB)
> tail += 3;
> else