summaryrefslogtreecommitdiffstats
path: root/drivers/net/wan
diff options
context:
space:
mode:
authorVasyl Gomonovych <gomonovych@gmail.com>2017-11-22 16:29:57 +0100
committerDavid S. Miller <davem@davemloft.net>2017-11-28 10:57:54 -0500
commitf95d5bf03b5ec0d7ea8e552e15abe70c646249b5 (patch)
treed079a1d177f77e4f441764f2f1c78fd4ef58cfb9 /drivers/net/wan
parentdea521a2b9f96e905fa2bb2f95e23ec00c2ec436 (diff)
downloadlinux-f95d5bf03b5ec0d7ea8e552e15abe70c646249b5.tar.bz2
lmc: Use memdup_user() as a cleanup
Fix coccicheck warning which recommends to use memdup_user(): drivers/net/wan/lmc/lmc_main.c:497:27-34: WARNING opportunity for memdup_user Generated by: scripts/coccinelle/memdup_user/memdup_user.cocci Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wan')
-rw-r--r--drivers/net/wan/lmc/lmc_main.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index 37b1e0d03e31..90a4ad9a2d08 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -494,18 +494,11 @@ int lmc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
break;
}
- data = kmalloc(xc.len, GFP_KERNEL);
- if (!data) {
- ret = -ENOMEM;
+ data = memdup_user(xc.data, xc.len);
+ if (IS_ERR(data)) {
+ ret = PTR_ERR(data);
break;
}
-
- if(copy_from_user(data, xc.data, xc.len))
- {
- kfree(data);
- ret = -ENOMEM;
- break;
- }
printk("%s: Starting load of data Len: %d at 0x%p == 0x%p\n", dev->name, xc.len, xc.data, data);