diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-04-09 19:50:39 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-04-09 19:50:39 +0000 |
commit | ec8e8ad5c7d3b15fa1ee3e03c3080a0f49a71923 (patch) | |
tree | c60eb0b9b17d8409396fd0bed3725dbb2125b7ed /sys/dev/ic/com.c | |
parent | 5c65555344f5adae4cb96b9157b0f0e218ea3f5f (diff) |
Increase buffer size sent to the fifo, and clamp the size correctly.
Scrub the buffer afterwards, too
Diffstat (limited to 'sys/dev/ic/com.c')
-rw-r--r-- | sys/dev/ic/com.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 2ed5b36e0fe..05f810a812b 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com.c,v 1.121 2008/01/23 16:37:55 jsing Exp $ */ +/* $OpenBSD: com.c,v 1.122 2008/04/09 19:50:38 deraadt Exp $ */ /* $NetBSD: com.c,v 1.82.4.1 1996/06/02 09:08:00 mrg Exp $ */ /* @@ -918,14 +918,15 @@ comstart(struct tty *tp) } if (ISSET(sc->sc_hwflags, COM_HW_FIFO)) { - u_char buffer[64]; /* XXX: largest fifo */ - - int n = q_to_b(&tp->t_outq, buffer, sc->sc_fifolen); - int i; + u_char buffer[128]; /* largest fifo */ + int i, n; + n = q_to_b(&tp->t_outq, buffer, + min(sc->sc_fifolen, sizeof buffer)); for (i = 0; i < n; i++) { bus_space_write_1(iot, ioh, com_data, buffer[i]); } + bzero(buffer, n); } else if (tp->t_outq.c_cc != 0) bus_space_write_1(iot, ioh, com_data, getc(&tp->t_outq)); out: |