aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-05-17 22:53:05 -0400
committerIan Moffett <ian@osmora.org>2024-05-17 22:53:05 -0400
commitbc4e474ed84e77335ab90668378df7ec22cd571e (patch)
tree2f34a80f47ee2bd1db2314dcf21bcfdf7bc7a442
parent15cee5e041b863ecd3fd0891709038f30d33632f (diff)
kernel: tty: Append to ring before length check
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/kern/kern_tty.c2
1 files changed, 1 insertions, 1 deletions
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;
}