diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-19 00:02:50 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-19 00:02:50 +0100 |
commit | 61b6b7fbda1bcef6d3df6b789e6bb178ee83d3d8 (patch) | |
tree | ed23eb87f0b1152118985f93a5f19ef66629bb9e /drivers/hid/hid-roccat-pyra.c | |
parent | vt: fix locking around vt_bind/vt_unbind (diff) | |
parent | Linux 3.19-rc5 (diff) | |
download | linux-61b6b7fbda1bcef6d3df6b789e6bb178ee83d3d8.tar.xz linux-61b6b7fbda1bcef6d3df6b789e6bb178ee83d3d8.zip |
Merge 3.19-rc5 into tty-next
We want those tty fixes in that release in this branch as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hid/hid-roccat-pyra.c')
-rw-r--r-- | drivers/hid/hid-roccat-pyra.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c index 1a07e07d99a0..47d7e74231e5 100644 --- a/drivers/hid/hid-roccat-pyra.c +++ b/drivers/hid/hid-roccat-pyra.c @@ -35,6 +35,8 @@ static struct class *pyra_class; static void profile_activated(struct pyra_device *pyra, unsigned int new_profile) { + if (new_profile >= ARRAY_SIZE(pyra->profile_settings)) + return; pyra->actual_profile = new_profile; pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi; } @@ -257,9 +259,11 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp, if (off != 0 || count != PYRA_SIZE_SETTINGS) return -EINVAL; - mutex_lock(&pyra->pyra_lock); - settings = (struct pyra_settings const *)buf; + if (settings->startup_profile >= ARRAY_SIZE(pyra->profile_settings)) + return -EINVAL; + + mutex_lock(&pyra->pyra_lock); retval = pyra_set_settings(usb_dev, settings); if (retval) { |