HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 10 Jan 2018 09:39:03 +0000 (12:39 +0300)
committerJiri Kosina <jkosina@suse.cz>
Tue, 23 Jan 2018 14:46:58 +0000 (15:46 +0100)
commit7ad81482cad67cbe1ec808490d1ddfc420c42008
tree0224b26501aa50635630d3300382025ae63e1e97
parent7cb4774e2d3282d29edd00762167876a27cc7d2a
HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()

We get the "new_profile_index" value from the mouse device when we're
handling raw events.  Smatch taints it as untrusted data and complains
that we need a bounds check.  This seems like a reasonable warning
otherwise there is a small read beyond the end of the array.

Fixes: 0e70f97f257e ("HID: roccat: Add support for Kova[+] mouse")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Silvan Jegen <s.jegen@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-roccat-kovaplus.c