HID: roccat: add bounds checking in kone_sysfs_write_settings()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 24 Aug 2020 08:57:35 +0000 (11:57 +0300)
committerJiri Kosina <jkosina@suse.cz>
Wed, 9 Sep 2020 06:35:15 +0000 (08:35 +0200)
commitd4f98dbfe717490e771b6e701904bfcf4b4557f0
tree09a6c5c7db6a4117f89a8b8fc4eefb886b2e612d
parent35556bed836f8dc07ac55f69c8d17dce3e7f0e25
HID: roccat: add bounds checking in kone_sysfs_write_settings()

This code doesn't check if "settings->startup_profile" is within bounds
and that could result in an out of bounds array access.  What the code
does do is it checks if the settings can be written to the firmware, so
it's possible that the firmware has a bounds check?  It's safer and
easier to verify when the bounds checking is done in the kernel.

Fixes: 14bf62cde794 ("HID: add driver for Roccat Kone gaming mouse")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-roccat-kone.c