Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()
@ 2020-08-15 8:48 Miaohe Lin
2020-08-18 22:55 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Miaohe Lin @ 2020-08-15 8:48 UTC (permalink / raw)
To: davem, kuba, pshelar, martin.varghese, fw, dcaratti, edumazet,
steffen.klassert, pabeni, shmulik, kyk.segfault
Cc: netdev, linux-kernel, linmiaohe
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>
---
net/core/skbuff.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index afbc1a79dc8a..44b7010e4813 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;
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear()
2020-08-15 8:48 [PATCH v2] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear() Miaohe Lin
@ 2020-08-18 22:55 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-08-18 22:55 UTC (permalink / raw)
To: linmiaohe
Cc: kuba, pshelar, martin.varghese, fw, dcaratti, edumazet,
steffen.klassert, pabeni, shmulik, kyk.segfault, netdev,
linux-kernel
From: Miaohe Lin <linmiaohe@huawei.com>
Date: Sat, 15 Aug 2020 04:48:53 -0400
> 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>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-18 22:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-15 8:48 [PATCH v2] net: eliminate meaningless memcpy to data in pskb_carve_inside_nonlinear() Miaohe Lin
2020-08-18 22:55 ` 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).