HID: roccat: potential out of bounds in pyra_sysfs_write_settings()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 9 Jan 2015 12:32:31 +0000 (15:32 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Jan 2015 14:59:01 +0000 (06:59 -0800)
commit94bb429ef60ffe198fbd250ce852d57d06fd02e4
tree9a933ce36b0bee62e924cae74c0a9b2c23503d67
parent32b57c08f4cca3bf821606a2f598fc397a143127
HID: roccat: potential out of bounds in pyra_sysfs_write_settings()

commit 606185b20caf4c57d7e41e5a5ea4aff460aef2ab upstream.

This is a static checker fix.  We write some binary settings to the
sysfs file.  One of the settings is the "->startup_profile".  There
isn't any checking to make sure it fits into the
pyra->profile_settings[] array in the profile_activated() function.

I added a check to pyra_sysfs_write_settings() in both places because
I wasn't positive that the other callers were correct.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/hid-roccat-pyra.c