summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/hid/hid-cypress.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/drivers/hid/hid-cypress.c')
-rw-r--r--kernel/drivers/hid/hid-cypress.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/drivers/hid/hid-cypress.c b/kernel/drivers/hid/hid-cypress.c
index 1b764d174..1689568b5 100644
--- a/kernel/drivers/hid/hid-cypress.c
+++ b/kernel/drivers/hid/hid-cypress.c
@@ -39,6 +39,9 @@ static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX))
return rdesc;
+ if (*rsize < 4)
+ return rdesc;
+
for (i = 0; i < *rsize - 4; i++)
if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) {
rdesc[i] = 0x19;