提交 4390b9e0 编写于 作者: R Roel Kluin 提交者: Linus Torvalds

dtlk: off by one in {read,write}_tts()

With a postfix increment retries is incremented beyond DTLK_MAX_RETRIES so
the error message is not displayed correctly.
Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
Cc: James R. Van Zandt <jrv@vanzandt.mv.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 befca967
...@@ -571,7 +571,7 @@ static char dtlk_read_tts(void) ...@@ -571,7 +571,7 @@ static char dtlk_read_tts(void)
portval = inb_p(dtlk_port_tts); portval = inb_p(dtlk_port_tts);
} while ((portval & TTS_READABLE) == 0 && } while ((portval & TTS_READABLE) == 0 &&
retries++ < DTLK_MAX_RETRIES); retries++ < DTLK_MAX_RETRIES);
if (retries == DTLK_MAX_RETRIES) if (retries > DTLK_MAX_RETRIES)
printk(KERN_ERR "dtlk_read_tts() timeout\n"); printk(KERN_ERR "dtlk_read_tts() timeout\n");
ch = inb_p(dtlk_port_tts); /* input from TTS port */ ch = inb_p(dtlk_port_tts); /* input from TTS port */
...@@ -583,7 +583,7 @@ static char dtlk_read_tts(void) ...@@ -583,7 +583,7 @@ static char dtlk_read_tts(void)
portval = inb_p(dtlk_port_tts); portval = inb_p(dtlk_port_tts);
} while ((portval & TTS_READABLE) != 0 && } while ((portval & TTS_READABLE) != 0 &&
retries++ < DTLK_MAX_RETRIES); retries++ < DTLK_MAX_RETRIES);
if (retries == DTLK_MAX_RETRIES) if (retries > DTLK_MAX_RETRIES)
printk(KERN_ERR "dtlk_read_tts() timeout\n"); printk(KERN_ERR "dtlk_read_tts() timeout\n");
TRACE_RET; TRACE_RET;
...@@ -640,7 +640,7 @@ static char dtlk_write_tts(char ch) ...@@ -640,7 +640,7 @@ static char dtlk_write_tts(char ch)
while ((inb_p(dtlk_port_tts) & TTS_WRITABLE) == 0 && while ((inb_p(dtlk_port_tts) & TTS_WRITABLE) == 0 &&
retries++ < DTLK_MAX_RETRIES) /* DT ready? */ retries++ < DTLK_MAX_RETRIES) /* DT ready? */
; ;
if (retries == DTLK_MAX_RETRIES) if (retries > DTLK_MAX_RETRIES)
printk(KERN_ERR "dtlk_write_tts() timeout\n"); printk(KERN_ERR "dtlk_write_tts() timeout\n");
outb_p(ch, dtlk_port_tts); /* output to TTS port */ outb_p(ch, dtlk_port_tts); /* output to TTS port */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册