OSDN Git Service
(root)
/
tomoyo
/
tomoyo-test1.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
26894cd
)
net: mpls: fix memdup.cocci warning
author
GONG, Ruiqi
<gongruiqi1@huawei.com>
Wed, 6 Apr 2022 11:46:29 +0000
(19:46 +0800)
committer
Jakub Kicinski
<kuba@kernel.org>
Fri, 8 Apr 2022 04:06:41 +0000
(21:06 -0700)
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>
net/mpls/af_mpls.c
patch
|
blob
|
history
diff --git
a/net/mpls/af_mpls.c
b/net/mpls/af_mpls.c
index
d6fdc57
..
35b5f80
100644
(file)
--- 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 = km
alloc(
size, GFP_KERNEL);
+ rt = km
emdup(orig,
size, GFP_KERNEL);
if (!rt)
return -ENOMEM;
- memcpy(rt, orig, size);
}
}