projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f8b2990
)
ipv6: sr: Use kmemdup instead of duplicating it in parse_nla_srh
author
YueHaibing
<yuehaibing@huawei.com>
Mon, 23 Jul 2018 08:33:19 +0000
(16:33 +0800)
committer
David S. Miller
<davem@davemloft.net>
Mon, 23 Jul 2018 16:39:07 +0000
(09:39 -0700)
Replace calls to kmalloc followed by a memcpy with a direct call to
kmemdup.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/seg6_local.c
patch
|
blob
|
history
diff --git
a/net/ipv6/seg6_local.c
b/net/ipv6/seg6_local.c
index cd6e4cab63f6ca37e0bd7699ca1208ae94aad410..e1025b493a185ee8eaba0941c05bc293b025343f 100644
(file)
--- a/
net/ipv6/seg6_local.c
+++ b/
net/ipv6/seg6_local.c
@@
-637,12
+637,10
@@
static int parse_nla_srh(struct nlattr **attrs, struct seg6_local_lwt *slwt)
if (!seg6_validate_srh(srh, len))
return -EINVAL;
- slwt->srh = km
alloc(
len, GFP_KERNEL);
+ slwt->srh = km
emdup(srh,
len, GFP_KERNEL);
if (!slwt->srh)
return -ENOMEM;
- memcpy(slwt->srh, srh, len);
-
slwt->headroom += len;
return 0;