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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 May 2018 05:50:21 +0000 (07:50 +0200)
commit5d193635af978a2bbb006414886e664eddc296b5
treeab5ba71c4d642cfc25173ac935024ed4a85b30ea
parent3feba5904807315eaf5ce50369923a4a034e4904
HID: roccat: prevent an out of bounds read in kovaplus_profile_activated()

[ Upstream commit 7ad81482cad67cbe1ec808490d1ddfc420c42008 ]

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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/hid-roccat-kovaplus.c