* [PATCH net-next] ipv6: sr: Use kmemdup instead of duplicating it in parse_nla_srh
@ 2018-07-23 8:33 YueHaibing
2018-07-23 16:39 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2018-07-23 8:33 UTC (permalink / raw)
To: davem, kuznet, yoshfuji; +Cc: linux-kernel, netdev, YueHaibing
Replace calls to kmalloc followed by a memcpy with a direct call to
kmemdup.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
net/ipv6/seg6_local.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
index cd6e4ca..e1025b4 100644
--- 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 = kmalloc(len, GFP_KERNEL);
+ slwt->srh = kmemdup(srh, len, GFP_KERNEL);
if (!slwt->srh)
return -ENOMEM;
- memcpy(slwt->srh, srh, len);
-
slwt->headroom += len;
return 0;
--
2.7.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] ipv6: sr: Use kmemdup instead of duplicating it in parse_nla_srh
2018-07-23 8:33 [PATCH net-next] ipv6: sr: Use kmemdup instead of duplicating it in parse_nla_srh YueHaibing
@ 2018-07-23 16:39 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-07-23 16:39 UTC (permalink / raw)
To: yuehaibing; +Cc: kuznet, yoshfuji, linux-kernel, netdev
From: YueHaibing <yuehaibing@huawei.com>
Date: Mon, 23 Jul 2018 16:33:19 +0800
> Replace calls to kmalloc followed by a memcpy with a direct call to
> kmemdup.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-23 16:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-23 8:33 [PATCH net-next] ipv6: sr: Use kmemdup instead of duplicating it in parse_nla_srh YueHaibing
2018-07-23 16:39 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).