Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 1ceb3628 80f8dccf

+3 -7
+3 -7
arch/um/drivers/hostaudio_kern.c
··· 105 105 printk(KERN_DEBUG "hostaudio: write called, count = %d\n", count); 106 106 #endif 107 107 108 - kbuf = kmalloc(count, GFP_KERNEL); 109 - if (kbuf == NULL) 110 - return -ENOMEM; 111 - 112 - err = -EFAULT; 113 - if (copy_from_user(kbuf, buffer, count)) 114 - goto out; 108 + kbuf = memdup_user(buffer, count); 109 + if (IS_ERR(kbuf)) 110 + return PTR_ERR(kbuf); 115 111 116 112 err = os_write_file(state->fd, kbuf, count); 117 113 if (err < 0)