aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers/mouse.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/mouse.c')
-rw-r--r--kernel/drivers/mouse.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/drivers/mouse.c b/kernel/drivers/mouse.c
index 40094d1..5c481da 100644
--- a/kernel/drivers/mouse.c
+++ b/kernel/drivers/mouse.c
@@ -94,10 +94,10 @@ static s32 mouse_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_mouse *e = stack_pop(queue);
+ memcpy(buf, (u8 *)e + offset, MIN(count, sizeof(*e)));
free(e);
- return count;
+ return MIN(count, sizeof(*e));
}
void mouse_install(void)