提交 1ceb3628 编写于 作者: A Al Viro

[um] hostaudio: don't open-code memdup_user()

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 80f8dccf
...@@ -105,13 +105,9 @@ static ssize_t hostaudio_write(struct file *file, const char __user *buffer, ...@@ -105,13 +105,9 @@ static ssize_t hostaudio_write(struct file *file, const char __user *buffer,
printk(KERN_DEBUG "hostaudio: write called, count = %d\n", count); printk(KERN_DEBUG "hostaudio: write called, count = %d\n", count);
#endif #endif
kbuf = kmalloc(count, GFP_KERNEL); kbuf = memdup_user(buffer, count);
if (kbuf == NULL) if (IS_ERR(kbuf))
return -ENOMEM; return PTR_ERR(kbuf);
err = -EFAULT;
if (copy_from_user(kbuf, buffer, count))
goto out;
err = os_write_file(state->fd, kbuf, count); err = os_write_file(state->fd, kbuf, count);
if (err < 0) if (err < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册