diff options
Diffstat (limited to 'drivers/misc/sgi-gru')
-rw-r--r-- | drivers/misc/sgi-gru/gruprocfs.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c index ccd4408a26c7..3f2375c5ba5b 100644 --- a/drivers/misc/sgi-gru/gruprocfs.c +++ b/drivers/misc/sgi-gru/gruprocfs.c | |||
@@ -161,14 +161,15 @@ static int options_show(struct seq_file *s, void *p) | |||
161 | static ssize_t options_write(struct file *file, const char __user *userbuf, | 161 | static ssize_t options_write(struct file *file, const char __user *userbuf, |
162 | size_t count, loff_t *data) | 162 | size_t count, loff_t *data) |
163 | { | 163 | { |
164 | unsigned long val; | 164 | char buf[20]; |
165 | char buf[80]; | ||
166 | 165 | ||
167 | if (strncpy_from_user(buf, userbuf, sizeof(buf) - 1) < 0) | 166 | if (count >= sizeof(buf)) |
167 | return -EINVAL; | ||
168 | if (copy_from_user(buf, userbuf, count)) | ||
168 | return -EFAULT; | 169 | return -EFAULT; |
169 | buf[count - 1] = '\0'; | 170 | buf[count] = '\0'; |
170 | if (!strict_strtoul(buf, 10, &val)) | 171 | if (strict_strtoul(buf, 0, &gru_options)) |
171 | gru_options = val; | 172 | return -EINVAL; |
172 | 173 | ||
173 | return count; | 174 | return count; |
174 | } | 175 | } |