From 1ceb36285c256347ffa062b7b1b593f801b6697b Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 2 Jan 2016 14:50:51 -0500 Subject: [um] hostaudio: don't open-code memdup_user() Signed-off-by: Al Viro --- arch/um/drivers/hostaudio_kern.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c index f6b911cc3923..3a4b58730f5f 100644 --- a/arch/um/drivers/hostaudio_kern.c +++ b/arch/um/drivers/hostaudio_kern.c @@ -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) -- cgit v1.2.3