Skip to content

Commit

Permalink
[um] hostaudio: don't open-code memdup_user()
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jan 4, 2016
1 parent 80f8dcc commit 1ceb362
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions arch/um/drivers/hostaudio_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
#endif

kbuf = kmalloc(count, GFP_KERNEL);
if (kbuf == NULL)
return -ENOMEM;

err = -EFAULT;
if (copy_from_user(kbuf, buffer, count))
goto out;
kbuf = memdup_user(buffer, count);
if (IS_ERR(kbuf))
return PTR_ERR(kbuf);

err = os_write_file(state->fd, kbuf, count);
if (err < 0)
Expand Down

0 comments on commit 1ceb362

Please sign in to comment.