Commit fc6e7568 authored by Henrique de Moraes Holschuh's avatar Henrique de Moraes Holschuh Committed by Matthew Garrett

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: default avatarJaime Velasco Juan <jsagarribay@gmail.com>
Signed-off-by: default avatarHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
parent 58e226c6
...@@ -3093,7 +3093,8 @@ static const struct tpacpi_quirk tpacpi_hotkey_qtable[] __initconst = { ...@@ -3093,7 +3093,8 @@ static const struct tpacpi_quirk tpacpi_hotkey_qtable[] __initconst = {
TPACPI_Q_IBM('1', 'D', TPACPI_HK_Q_INIMASK), /* X22, X23, X24 */ TPACPI_Q_IBM('1', 'D', TPACPI_HK_Q_INIMASK), /* X22, X23, X24 */
}; };
typedef u16 tpacpi_keymap_t[TPACPI_HOTKEY_MAP_LEN]; typedef u16 tpacpi_keymap_entry_t;
typedef tpacpi_keymap_entry_t tpacpi_keymap_t[TPACPI_HOTKEY_MAP_LEN];
static int __init hotkey_init(struct ibm_init_struct *iibm) static int __init hotkey_init(struct ibm_init_struct *iibm)
{ {
...@@ -3230,7 +3231,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) ...@@ -3230,7 +3231,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
}; };
#define TPACPI_HOTKEY_MAP_SIZE sizeof(tpacpi_keymap_t) #define TPACPI_HOTKEY_MAP_SIZE sizeof(tpacpi_keymap_t)
#define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(tpacpi_keymap_t[0]) #define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(tpacpi_keymap_entry_t)
int res, i; int res, i;
int status; int status;
......
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