mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] input: console: skip unmappable keys
@ 2021-03-29  6:18 Ahmad Fatoum
  2021-03-29  6:18 ` [PATCH 2/3] input: add virtio input driver Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2021-03-29  6:18 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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>
---
 drivers/input/input.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index bcc8667417d9..1df52f56c84d 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;
-- 
2.30.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

end of thread, other threads:[~2021-03-30  5:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29  6:18 [PATCH 1/3] input: console: skip unmappable keys Ahmad Fatoum
2021-03-29  6:18 ` [PATCH 2/3] input: add virtio input driver Ahmad Fatoum
2021-03-29  6:18 ` [PATCH 3/3] input: virtio_input: add sound support Ahmad Fatoum
2021-03-30  5:27 ` [PATCH 1/3] input: console: skip unmappable keys Sascha Hauer

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