Skip to contentSkip to conversation

tty: incorrect test of echo_buf() result for ECHO_OP_START

PATCH Roel Kluin 3 participants 3 messages Oct 11, 2013 1 message not in the archive TTY layer and serial drivers

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

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

---

drivers/tty/n_tty.c +1 -1
index 7a744b6..42b6cca 100644
@@ -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

A message that is not in the archive (sent off-list or not yet received): CABPwjKd-e+Pq5OsNptn243WJ0a=qKizAsB3KATekMRTvsHab+g@mail.gmail.com

#2 lore raw
Quoted 1 line · Roel Kluin

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

#3 lore raw
In reply to Roel Kluin
Quoted 1 line · Roel Kluin

Untested, but this looks like a bug to me

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

Regards,
Peter Hurley

Quoted 18 lines

-----------
test echo_buf() result for ECHO_OP_START

---

drivers/tty/n_tty.c +1 -1
index 7a744b6..42b6cca 100644
@@ -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