From 7dde402982e6401a016593be6cffcc2fcdf8b59a Mon Sep 17 00:00:00 2001 From: liuhongchao Date: Wed, 5 Jul 2023 14:31:21 +0800 Subject: [PATCH] drivers/input:Fix setting the number of keyboard driver buffers fails Buffer nums is not multiplied by the structure size Signed-off-by: liuhongchao --- drivers/input/keyboard_upper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/input/keyboard_upper.c b/drivers/input/keyboard_upper.c index 7dfa28bfcb..b1c4a84291 100644 --- a/drivers/input/keyboard_upper.c +++ b/drivers/input/keyboard_upper.c @@ -123,7 +123,8 @@ static int keyboard_open(FAR struct file *filep) /* Initializes the buffer for each open file */ - ret = circbuf_init(&opriv->circ, NULL, upper->nums); + ret = circbuf_init(&opriv->circ, NULL, + upper->nums * sizeof(struct keyboard_event_s)); if (ret < 0) { kmm_free(opriv);