Skip to content

Commit

Permalink
Input: tc3589x-keypad - fix keymap size
Browse files Browse the repository at this point in the history
The keymap size used by tc3589x is too low, leading to the driver
overwriting other people's memory.  Fix this by making the driver
use the automatically allocated keymap provided by
matrix_keypad_build_keymap() instead of allocating one on its own.

Signed-off-by: Rabin Vincent <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
  • Loading branch information
vitkyrka authored and dtor committed Mar 11, 2013
1 parent 5869483 commit 3973501
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/input/keyboard/tc3589x-keypad.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@
#define TC3589x_EVT_INT_CLR 0x2
#define TC3589x_KBD_INT_CLR 0x1

#define TC3589x_KBD_KEYMAP_SIZE 64

/**
* struct tc_keypad - data structure used by keypad driver
* @tc3589x: pointer to tc35893
Expand All @@ -88,7 +86,7 @@ struct tc_keypad {
const struct tc3589x_keypad_platform_data *board;
unsigned int krow;
unsigned int kcol;
unsigned short keymap[TC3589x_KBD_KEYMAP_SIZE];
unsigned short *keymap;
bool keypad_stopped;
};

Expand Down Expand Up @@ -338,12 +336,14 @@ static int tc3589x_keypad_probe(struct platform_device *pdev)

error = matrix_keypad_build_keymap(plat->keymap_data, NULL,
TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL,
keypad->keymap, input);
NULL, input);
if (error) {
dev_err(&pdev->dev, "Failed to build keymap\n");
goto err_free_mem;
}

keypad->keymap = input->keycode;

input_set_capability(input, EV_MSC, MSC_SCAN);
if (!plat->no_autorepeat)
__set_bit(EV_REP, input->evbit);
Expand Down

0 comments on commit 3973501

Please sign in to comment.