Commit fc6e756894b703952fd277a1f98a5d93e7ba847a
Committed by
Matthew Garrett
1 parent
58e226c6d4
Exists in
master
and in
7 other branches
thinkpad-acpi: avoid keymap pitfall
Change the code so that it will use the correct size for keymap entries. Do it in a way that makes it harder to screw it up in the future. Reported-by: Jaime Velasco Juan <jsagarribay@gmail.com> Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff
drivers/platform/x86/thinkpad_acpi.c
... | ... | @@ -3093,7 +3093,8 @@ |
3093 | 3093 | TPACPI_Q_IBM('1', 'D', TPACPI_HK_Q_INIMASK), /* X22, X23, X24 */ |
3094 | 3094 | }; |
3095 | 3095 | |
3096 | -typedef u16 tpacpi_keymap_t[TPACPI_HOTKEY_MAP_LEN]; | |
3096 | +typedef u16 tpacpi_keymap_entry_t; | |
3097 | +typedef tpacpi_keymap_entry_t tpacpi_keymap_t[TPACPI_HOTKEY_MAP_LEN]; | |
3097 | 3098 | |
3098 | 3099 | static int __init hotkey_init(struct ibm_init_struct *iibm) |
3099 | 3100 | { |
... | ... | @@ -3230,7 +3231,7 @@ |
3230 | 3231 | }; |
3231 | 3232 | |
3232 | 3233 | #define TPACPI_HOTKEY_MAP_SIZE sizeof(tpacpi_keymap_t) |
3233 | -#define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(tpacpi_keymap_t[0]) | |
3234 | +#define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(tpacpi_keymap_entry_t) | |
3234 | 3235 | |
3235 | 3236 | int res, i; |
3236 | 3237 | int status; |