File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -674,10 +674,11 @@ static void process_packet_head_v4(struct psmouse *psmouse)
674
674
struct input_dev * dev = psmouse -> dev ;
675
675
struct elantech_data * etd = psmouse -> private ;
676
676
unsigned char * packet = psmouse -> packet ;
677
- int id = (( packet [ 3 ] & 0xe0 ) >> 5 ) - 1 ;
677
+ int id ;
678
678
int pres , traces ;
679
679
680
- if (id < 0 )
680
+ id = ((packet [3 ] & 0xe0 ) >> 5 ) - 1 ;
681
+ if (id < 0 || id >= ETP_MAX_FINGERS )
681
682
return ;
682
683
683
684
etd -> mt [id ].x = ((packet [1 ] & 0x0f ) << 8 ) | packet [2 ];
@@ -707,7 +708,7 @@ static void process_packet_motion_v4(struct psmouse *psmouse)
707
708
int id , sid ;
708
709
709
710
id = ((packet [0 ] & 0xe0 ) >> 5 ) - 1 ;
710
- if (id < 0 )
711
+ if (id < 0 || id >= ETP_MAX_FINGERS )
711
712
return ;
712
713
713
714
sid = ((packet [3 ] & 0xe0 ) >> 5 ) - 1 ;
@@ -728,7 +729,7 @@ static void process_packet_motion_v4(struct psmouse *psmouse)
728
729
input_report_abs (dev , ABS_MT_POSITION_X , etd -> mt [id ].x );
729
730
input_report_abs (dev , ABS_MT_POSITION_Y , etd -> mt [id ].y );
730
731
731
- if (sid >= 0 ) {
732
+ if (sid >= 0 && sid < ETP_MAX_FINGERS ) {
732
733
etd -> mt [sid ].x += delta_x2 * weight ;
733
734
etd -> mt [sid ].y -= delta_y2 * weight ;
734
735
input_mt_slot (dev , sid );
You can’t perform that action at this time.
0 commit comments