summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorMiaohe Lin <linmiaohe@huawei.com>2020-08-15 04:48:53 -0400
committerDavid S. Miller <davem@davemloft.net>2020-08-18 15:55:24 -0700
commite3ec1e8ca02b7e6c935bba3f9b6da86c2e57d2eb (patch)
tree3abbfe2a791c1a43136d3326e2f67da9207fe4cb /net/core
parent46191546d03d2e0c18d1c1d18e1ce11f5e717f28 (diff)
net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()
The frags of skb_shared_info of the data is assigned in following loop. It is meaningless to do a memcpy of frags here. Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/skbuff.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 5c3b906aeef3..2f7dd689bccc 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -5953,8 +5953,7 @@ static int pskb_carve_inside_nonlinear(struct sk_buff *skb, const u32 off,
size = SKB_WITH_OVERHEAD(ksize(data));
memcpy((struct skb_shared_info *)(data + size),
- skb_shinfo(skb), offsetof(struct skb_shared_info,
- frags[skb_shinfo(skb)->nr_frags]));
+ skb_shinfo(skb), offsetof(struct skb_shared_info, frags[0]));
if (skb_orphan_frags(skb, gfp_mask)) {
kfree(data);
return -ENOMEM;