summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2021-03-29 08:18:08 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-03-30 07:21:11 +0200
commit100c89870c8595f9a2228750a8bc60a5ccded158 (patch)
treeed0290c8dba6c4c63017b66808035b8d112ffbc8 /drivers
parentdd228f7615a2acefc5e29d28daa53b5ca39fe6fb (diff)
downloadbarebox-100c89870c8595f9a2228750a8bc60a5ccded158.tar.gz
barebox-100c89870c8595f9a2228750a8bc60a5ccded158.tar.xz
input: console: skip unmappable keys
The input console is in charge of turning input events to barebox console keycodes. The keymap array it uses to do so has NR_KEYS entries. Keycodes with values >= NR_KEYS can thus not be mapped. Ignore them instead of evaluating arbitrary memory contents beyond the buffer. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/input.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index bcc8667417..1df52f56c8 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -165,6 +165,9 @@ static void input_console_notify(struct input_notifier *in,
if (ic->modstate[4] || ic->modstate[5])
modstate |= 1 << 2;
+ if (ev->code >= NR_KEYS)
+ return;
+
if (modstate & (1 << 1)) {
ascii = keycode_bb_keys[ev->code];
ascii = ascii >= 'a' ? CTL_CH(ascii) : 0;