git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
drm/radeon: Poll for both connect/disconnect on analog connectors
[pandora-kernel.git]
/
drivers
/
hid
/
hid-roccat-pyra.c
diff --git
a/drivers/hid/hid-roccat-pyra.c
b/drivers/hid/hid-roccat-pyra.c
index
df05c1b
..
13b40a0
100644
(file)
--- 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)
{
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;
}
pyra->actual_profile = new_profile;
pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi;
}
@@
-303,6
+305,10
@@
static ssize_t pyra_sysfs_write_settings(struct file *fp,
if (off != 0 || count != sizeof(struct pyra_settings))
return -EINVAL;
if (off != 0 || count != sizeof(struct pyra_settings))
return -EINVAL;
+ if (((struct pyra_settings const *)buf)->startup_profile >=
+ ARRAY_SIZE(pyra->profile_settings))
+ return -EINVAL;
+
mutex_lock(&pyra->pyra_lock);
difference = memcmp(buf, &pyra->settings, sizeof(struct pyra_settings));
if (difference) {
mutex_lock(&pyra->pyra_lock);
difference = memcmp(buf, &pyra->settings, sizeof(struct pyra_settings));
if (difference) {