Skip to content

Commit 802c038

Browse files
mitagregkh
authored andcommitted
sysrq: attach sysrq handler correctly for 32-bit kernel
The sysrq input handler should be attached to the input device which has a left alt key. On 32-bit kernels, some input devices which has a left alt key cannot attach sysrq handler. Because the keybit bitmap in struct input_device_id for sysrq is not correctly initialized. KEY_LEFTALT is 56 which is greater than BITS_PER_LONG on 32-bit kernels. I found this problem when using a matrix keypad device which defines a KEY_LEFTALT (56) but doesn't have a KEY_O (24 == 56%32). Cc: Jiri Slaby <[email protected]> Signed-off-by: Akinobu Mita <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6741f55 commit 802c038

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/tty/sysrq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,8 @@ static const struct input_device_id sysrq_ids[] = {
946946
{
947947
.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
948948
INPUT_DEVICE_ID_MATCH_KEYBIT,
949-
.evbit = { BIT_MASK(EV_KEY) },
950-
.keybit = { BIT_MASK(KEY_LEFTALT) },
949+
.evbit = { [BIT_WORD(EV_KEY)] = BIT_MASK(EV_KEY) },
950+
.keybit = { [BIT_WORD(KEY_LEFTALT)] = BIT_MASK(KEY_LEFTALT) },
951951
},
952952
{ },
953953
};

0 commit comments

Comments
 (0)