aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers/keyboard.c
diff options
context:
space:
mode:
authorMarvin Borner2021-03-14 16:06:57 +0100
committerMarvin Borner2021-03-14 16:06:57 +0100
commit6dec7db5158447b66f31a3f786ce2916cab83cec (patch)
tree2dbc3e52d90dab4aae8021773f09b6b72a74b8cb /kernel/drivers/keyboard.c
parent2f8328f2a41b77eea297ee7fc28818331d4e6c54 (diff)
Maaany fixes :)
I don't have the motivation to write better commit messages...
Diffstat (limited to 'kernel/drivers/keyboard.c')
-rw-r--r--kernel/drivers/keyboard.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/drivers/keyboard.c b/kernel/drivers/keyboard.c
index 3ae3c0e..dbee8e1 100644
--- a/kernel/drivers/keyboard.c
+++ b/kernel/drivers/keyboard.c
@@ -66,10 +66,10 @@ static s32 keyboard_read(void *buf, u32 offset, u32 count, struct device *dev)
if (stack_empty(queue))
return -1;
- struct event *e = stack_pop(queue);
- memcpy(buf, (u8 *)e + offset, count);
+ struct event_keyboard *e = stack_pop(queue);
+ memcpy(buf, (u8 *)e + offset, MIN(count, sizeof(*e)));
free(e);
- return count;
+ return MIN(count, sizeof(*e));
}
static u8 keyboard_ready(void)