Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -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;
		}