HID: core: prevent out-of-bound readings
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Tue, 19 Jan 2016 11:34:58 +0000 (12:34 +0100)
committermobile promotions <svcmobile_promotions@nvidia.com>
Mon, 28 Nov 2016 17:26:09 +0000 (09:26 -0800)
commitfbc389a39540e177bfa4d49b9214dfe408ef2d4a
tree86624bc182187f022fee2b36fdcf3f709889d1fc
parent2b1401855a2bdd31556a93feba50dd0dc0bb70e8
HID: core: prevent out-of-bound readings

Plugging a Logitech DJ receiver with KASAN activated raises a bunch of
out-of-bound readings.

The fields are allocated up to MAX_USAGE, meaning that potentially, we do
not have enough fields to fit the incoming values.
Add checks and silence KASAN.

Bug 1823317

Change-Id: Ib3ba92572acbdd4c9ec265e54a45f92606107700
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Gagan Grover <ggrover@nvidia.com>
Reviewed-on: http://git-master/r/1259928
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
drivers/hid/hid-core.c