aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers/keyboard.c
diff options
context:
space:
mode:
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)