aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-gru/gruprocfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/sgi-gru/gruprocfs.c')
-rw-r--r--drivers/misc/sgi-gru/gruprocfs.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c
index 797d7962cc88..4f7635922394 100644
--- a/drivers/misc/sgi-gru/gruprocfs.c
+++ b/drivers/misc/sgi-gru/gruprocfs.c
@@ -160,15 +160,11 @@ static int options_show(struct seq_file *s, void *p)
160static ssize_t options_write(struct file *file, const char __user *userbuf, 160static ssize_t options_write(struct file *file, const char __user *userbuf,
161 size_t count, loff_t *data) 161 size_t count, loff_t *data)
162{ 162{
163 char buf[20]; 163 int ret;
164 164
165 if (count >= sizeof(buf)) 165 ret = kstrtoul_from_user(userbuf, count, 0, &gru_options);
166 return -EINVAL; 166 if (ret)
167 if (copy_from_user(buf, userbuf, count)) 167 return ret;
168 return -EFAULT;
169 buf[count] = '\0';
170 if (strict_strtoul(buf, 0, &gru_options))
171 return -EINVAL;
172 168
173 return count; 169 return count;
174} 170}