Commit f95d5bf0 authored by Vasyl Gomonovych's avatar Vasyl Gomonovych Committed by David S. Miller

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: default avatarVasyl Gomonovych <gomonovych@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dea521a2
...@@ -494,16 +494,9 @@ int lmc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/ ...@@ -494,16 +494,9 @@ int lmc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
break; break;
} }
data = kmalloc(xc.len, GFP_KERNEL); data = memdup_user(xc.data, xc.len);
if (!data) { if (IS_ERR(data)) {
ret = -ENOMEM; ret = PTR_ERR(data);
break;
}
if(copy_from_user(data, xc.data, xc.len))
{
kfree(data);
ret = -ENOMEM;
break; 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