Input: mt6779-keypad - check the reported row and column
The interrupt handler turns register bits into a matrix position
and indexes the keycode array with it:
keypad->calc_row_col(key, &row, &col);
scancode = MATRIX_SCAN_CODE(row, col, row_shift);
...
input_report_key(keypad->input_dev, keycode[scancode], pressed);
The keycode array is sized after the rows and columns the device
tree declared, but neither the probe nor the handler checks that a
reported position actually fits those dimensions. A register glitch
or a matrix smaller than the hardware's fixed layout indexes past
the array and reports whatever sits there as a key code.
Skip positions outside the declared matrix.
Signed-off-by: Guanglei Zhu <zhugl3@xiaopeng.com>
Link: https://patch.msgid.link/20261103084135.426629-6-zhugl3@xiaopeng.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 file changed