aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/hid-logitech-hidpp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 2f420c0b6609..dd3c21b52de3 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -794,6 +794,11 @@ static int wtp_raw_event(struct hid_device *hdev, u8 *data, int size)
794 794
795 switch (data[0]) { 795 switch (data[0]) {
796 case 0x02: 796 case 0x02:
797 if (size < 2) {
798 hid_err(hdev, "Received HID report of bad size (%d)",
799 size);
800 return 1;
801 }
797 if (hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS) { 802 if (hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS) {
798 input_event(wd->input, EV_KEY, BTN_LEFT, 803 input_event(wd->input, EV_KEY, BTN_LEFT,
799 !!(data[1] & 0x01)); 804 !!(data[1] & 0x01));
@@ -806,6 +811,7 @@ static int wtp_raw_event(struct hid_device *hdev, u8 *data, int size)
806 return wtp_mouse_raw_xy_event(hidpp, &data[7]); 811 return wtp_mouse_raw_xy_event(hidpp, &data[7]);
807 } 812 }
808 case REPORT_ID_HIDPP_LONG: 813 case REPORT_ID_HIDPP_LONG:
814 /* size is already checked in hidpp_raw_event. */
809 if ((report->fap.feature_index != wd->mt_feature_index) || 815 if ((report->fap.feature_index != wd->mt_feature_index) ||
810 (report->fap.funcindex_clientid != EVENT_TOUCHPAD_RAW_XY)) 816 (report->fap.funcindex_clientid != EVENT_TOUCHPAD_RAW_XY))
811 return 1; 817 return 1;