From bc4e474ed84e77335ab90668378df7ec22cd571e Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 17 May 2024 22:53:05 -0400 Subject: kernel: tty: Append to ring before length check Signed-off-by: Ian Moffett --- sys/kern/kern_tty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_tty.c b/sys/kern/kern_tty.c index 39b94f7..641e7ba 100644 --- a/sys/kern/kern_tty.c +++ b/sys/kern/kern_tty.c @@ -135,12 +135,12 @@ tty_putc(struct tty *tty, int c) ring = &tty->ring; spinlock_acquire(&tty->rlock); + ring->data[ring->enq_index++] = c; if (ring->enq_index >= TTY_RING_SIZE) { __tty_flush(tty); } - ring->data[ring->enq_index++] = c; spinlock_release(&tty->rlock); return 0; } -- cgit v1.2.3