Commit 6d8edafc authored by Linus Torvalds's avatar Linus Torvalds

Properly limit keyboard keycodes to KEY_MAX.

It can only be set by root, but let's not tempt people to do
things that can't work.
parent a9fda9c4
...@@ -198,6 +198,8 @@ int setkeycode(unsigned int scancode, unsigned int keycode) ...@@ -198,6 +198,8 @@ int setkeycode(unsigned int scancode, unsigned int keycode)
if (scancode < 0 || scancode >= dev->keycodemax) if (scancode < 0 || scancode >= dev->keycodemax)
return -EINVAL; return -EINVAL;
if (keycode < 0 || keycode > KEY_MAX)
return -EINVAL;
oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode); oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment