Skip to content

Commit e3ec1e8

Browse files
MiaoheLindavem330
authored andcommitted
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>
1 parent 4619154 commit e3ec1e8

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎net/core/skbuff.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5953,8 +5953,7 @@ static int pskb_carve_inside_nonlinear(struct sk_buff *skb, const u32 off,
59535953
size = SKB_WITH_OVERHEAD(ksize(data));
59545954

59555955
memcpy((struct skb_shared_info *)(data + size),
5956-
skb_shinfo(skb), offsetof(struct skb_shared_info,
5957-
frags[skb_shinfo(skb)->nr_frags]));
5956+
skb_shinfo(skb), offsetof(struct skb_shared_info, frags[0]));
59585957
if (skb_orphan_frags(skb, gfp_mask)) {
59595958
kfree(data);
59605959
return -ENOMEM;

0 commit comments

Comments
 (0)