|
@@ -1348,11 +1348,10 @@ static ssize_t comm_write(struct file *file, const char __user *buf,
|
|
|
struct inode *inode = file_inode(file);
|
|
|
struct task_struct *p;
|
|
|
char buffer[TASK_COMM_LEN];
|
|
|
+ const size_t maxlen = sizeof(buffer) - 1;
|
|
|
|
|
|
memset(buffer, 0, sizeof(buffer));
|
|
|
- if (count > sizeof(buffer) - 1)
|
|
|
- count = sizeof(buffer) - 1;
|
|
|
- if (copy_from_user(buffer, buf, count))
|
|
|
+ if (copy_from_user(buffer, buf, count > maxlen ? maxlen : count))
|
|
|
return -EFAULT;
|
|
|
|
|
|
p = get_proc_task(inode);
|