[PATCH 1/3] Only process ABS_MT_SLOT where there are slots available

From: Benjamin Tissoires
Date: Wed Nov 20 2013 - 16:33:30 EST


From: Antonio Ospite <ospite@xxxxxxxxxxxxxxxxx>

This fixes the case when a non-multitouch device happens to have a HID
code equal to ABS_MT_SLOT, like the Sony Sixaxis has for the left dpad
analog control.

Updated to latest tree by Benjamin Tissoires.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx>
---

This patch was sent back in 2011 by Antonio and it was forgotten in the depth
of the LKML:
http://www.spinics.net/lists/linux-input/msg16881.html
Resurecting it now, as the bug is still there.

Antonio, could you please tell me if you still add your Signed-of-by line and
if I can keep your from?

Cheers,
Benjamin
drivers/input/input.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/input.c b/drivers/input/input.c
index fb513da..1198785 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -213,12 +213,12 @@ static int input_handle_abs_event(struct input_dev *dev,
bool is_mt_event;
int *pold;

- if (code == ABS_MT_SLOT) {
+ if (code == ABS_MT_SLOT && mt) {
/*
* "Stage" the event; we'll flush it later, when we
* get actual touch data.
*/
- if (mt && *pval >= 0 && *pval < mt->num_slots)
+ if (*pval >= 0 && *pval < mt->num_slots)
mt->slot = *pval;

return INPUT_IGNORE_EVENT;
--
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/