mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
convert a bunch of open-coded instances of memdup_user_nul()
A _lot_ of ->write() instances were open-coding it; some are converted to memdup_user_nul(), a lot more remain... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
7e935c7ca1
commit
16e5c1fc36
12 changed files with 71 additions and 197 deletions
|
@ -657,14 +657,9 @@ static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf,
|
|||
pr_warn("expected <%d bytes into control\n", USER_BUF_PAGE);
|
||||
return -E2BIG;
|
||||
}
|
||||
tmpbuf = kmalloc(len + 1, GFP_KERNEL);
|
||||
if (!tmpbuf)
|
||||
return -ENOMEM;
|
||||
if (copy_from_user(tmpbuf, ubuf, len)) {
|
||||
kfree(tmpbuf);
|
||||
return -EFAULT;
|
||||
}
|
||||
tmpbuf[len] = '\0';
|
||||
tmpbuf = memdup_user_nul(ubuf, len);
|
||||
if (IS_ERR(tmpbuf))
|
||||
return PTR_ERR(tmpbuf);
|
||||
vpr_info("read %d bytes from userspace\n", (int)len);
|
||||
|
||||
ret = ddebug_exec_queries(tmpbuf, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue