aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/proc/base.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a19308604145..3861bcec41ff 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1348,11 +1348,10 @@ static ssize_t comm_write(struct file *file, const char __user *buf,
1348 struct inode *inode = file_inode(file); 1348 struct inode *inode = file_inode(file);
1349 struct task_struct *p; 1349 struct task_struct *p;
1350 char buffer[TASK_COMM_LEN]; 1350 char buffer[TASK_COMM_LEN];
1351 const size_t maxlen = sizeof(buffer) - 1;
1351 1352
1352 memset(buffer, 0, sizeof(buffer)); 1353 memset(buffer, 0, sizeof(buffer));
1353 if (count > sizeof(buffer) - 1) 1354 if (copy_from_user(buffer, buf, count > maxlen ? maxlen : count))
1354 count = sizeof(buffer) - 1;
1355 if (copy_from_user(buffer, buf, count))
1356 return -EFAULT; 1355 return -EFAULT;
1357 1356
1358 p = get_proc_task(inode); 1357 p = get_proc_task(inode);