summaryrefslogtreecommitdiffstats
path: root/net/mpls
diff options
context:
space:
mode:
authorGONG, Ruiqi <gongruiqi1@huawei.com>2022-04-06 13:46:29 +0200
committerJakub Kicinski <kuba@kernel.org>2022-04-08 06:06:41 +0200
commit27a5a5685d373cd8c18b1d83f42a83e5a2f93e6c (patch)
tree8b8257ed892ebec37ff3459fe52ec5a38164d085 /net/mpls
parenthv_netvsc: Print value of invalid ID in netvsc_send_{completion,tx_complete}() (diff)
downloadlinux-27a5a5685d373cd8c18b1d83f42a83e5a2f93e6c.tar.xz
linux-27a5a5685d373cd8c18b1d83f42a83e5a2f93e6c.zip
net: mpls: fix memdup.cocci warning
Simply use kmemdup instead of explicitly allocating and copying memory. Generated by: scripts/coccinelle/api/memdup.cocci Signed-off-by: GONG, Ruiqi <gongruiqi1@huawei.com> Link: https://lore.kernel.org/r/20220406114629.182833-1-gongruiqi1@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/mpls')
-rw-r--r--net/mpls/af_mpls.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index d6fdc5782d33..35b5f806fdda 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -1527,10 +1527,9 @@ static int mpls_ifdown(struct net_device *dev, int event)
rt->rt_nh_size;
struct mpls_route *orig = rt;
- rt = kmalloc(size, GFP_KERNEL);
+ rt = kmemdup(orig, size, GFP_KERNEL);
if (!rt)
return -ENOMEM;
- memcpy(rt, orig, size);
}
}