Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH] Input: ipaq-micro-keys - add length check in micro_key_receive
@ 2026-06-10 23:02 Dmitry Torokhov
  2026-06-10 23:14 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Torokhov @ 2026-06-10 23:02 UTC (permalink / raw)
  To: linux-input; +Cc: Rosen Penev, linux-kernel

The driver accesses the message payload (msg[0]) without checking if
the length is greater than zero. The parent MFD driver can produce a
payload with a length of 0, in which case msg[0] would be uninitialized
or stale.

Add a check to return early if len is less than 1.

Reported-by: sashiko-bot@kernel.org
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/keyboard/ipaq-micro-keys.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/keyboard/ipaq-micro-keys.c b/drivers/input/keyboard/ipaq-micro-keys.c
index 3c7d6aa0fe29..ebd991de70f8 100644
--- a/drivers/input/keyboard/ipaq-micro-keys.c
+++ b/drivers/input/keyboard/ipaq-micro-keys.c
@@ -43,6 +43,9 @@ static void micro_key_receive(void *data, int len, unsigned char *msg)
 	struct ipaq_micro_keys *keys = data;
 	int key, down;
 
+	if (len < 1)
+		return;
+
 	down = 0x80 & msg[0];
 	key  = 0x7f & msg[0];
 
-- 
2.54.0.1099.g489fc7bff1-goog


-- 
Dmitry

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-10 23:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-10 23:02 [PATCH] Input: ipaq-micro-keys - add length check in micro_key_receive Dmitry Torokhov
2026-06-10 23:14 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox