Commit 8668f9a5 authored by YueHaibing's avatar YueHaibing Committed by Kalle Valo

atmel: use memdup_user to simplify the code

use existing memdup_user() helper function instead of open-coding
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 2d1e9be0
......@@ -2646,14 +2646,9 @@ static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
break;
}
if (!(new_firmware = kmalloc(com.len, GFP_KERNEL))) {
rc = -ENOMEM;
break;
}
if (copy_from_user(new_firmware, com.data, com.len)) {
kfree(new_firmware);
rc = -EFAULT;
new_firmware = memdup_user(com.data, com.len);
if (IS_ERR(new_firmware)) {
rc = PTR_ERR(new_firmware);
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment