diff options
| author | Aleksa Vuckovic <aleksav013@gmail.com> | 2022-12-05 00:02:06 +0100 |
|---|---|---|
| committer | Aleksa Vuckovic <aleksav013@gmail.com> | 2022-12-05 00:02:06 +0100 |
| commit | 32d96c66c088a58d80acf251d9576d0ed2e1b78c (patch) | |
| tree | b2b0c46fa9c69db01d283b0724c75ec2ab7589fd | |
| parent | 9ec2aeb349d3d935f61c195244b6464e939f4b51 (diff) | |
keyboard.c: not valid len for circular buff
| -rw-r--r-- | kernel/src/devices/keyboard.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/src/devices/keyboard.c b/kernel/src/devices/keyboard.c index 73c052c..549a0ca 100644 --- a/kernel/src/devices/keyboard.c +++ b/kernel/src/devices/keyboard.c @@ -66,7 +66,7 @@ void keyboard_handler() is_pressed[keycode - 128] = false; } - uint32_t len = (uint32_t)(keyboard_buffer->head - keyboard_buffer->tail); + uint32_t len = (uint32_t)(keyboard_buffer->head >= keyboard_buffer->tail ? keyboard_buffer->head - keyboard_buffer->tail : BUFFER_SIZE + keyboard_buffer->head - keyboard_buffer->tail); char* print_buff = kalloc(len + 1); read_buff(keyboard_buffer, print_buff, len); printf("%s", print_buff); |
