public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: [email protected], [email protected]
Cc: Jens Axboe <[email protected]>,
	[email protected], "David S . Miller" <[email protected]>,
	Jakub Kicinski <[email protected]>,
	David Ahern <[email protected]>,
	Eric Dumazet <[email protected]>,
	Willem de Bruijn <[email protected]>
Subject: [PATCH net-next 5/5] net: limit scope of a skb_zerocopy_iter_stream var
Date: Thu, 27 Jun 2024 13:59:45 +0100	[thread overview]
Message-ID: <3f4a39b3966204f062200caad857ff822f9f2895.1719190216.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

skb_zerocopy_iter_stream() only uses @orig_uarg in the !link_skb path,
and we can move the local variable in the appropriate block.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 net/core/skbuff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 9f28822dde6f..9b71e4b8796a 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1856,7 +1856,6 @@ int skb_zerocopy_iter_stream(struct sock *sk, struct sk_buff *skb,
 			     struct msghdr *msg, int len,
 			     struct ubuf_info *uarg)
 {
-	struct ubuf_info *orig_uarg = skb_zcopy(skb);
 	int err, orig_len = skb->len;
 
 	if (uarg->ops->link_skb) {
@@ -1864,6 +1863,8 @@ int skb_zerocopy_iter_stream(struct sock *sk, struct sk_buff *skb,
 		if (err)
 			return err;
 	} else {
+		struct ubuf_info *orig_uarg = skb_zcopy(skb);
+
 		/* An skb can only point to one uarg. This edge case happens
 		 * when TCP appends to an skb, but zerocopy_realloc triggered
 		 * a new alloc.
-- 
2.44.0


  parent reply	other threads:[~2024-06-27 12:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27 12:59 [PATCH net-next 0/5] zerocopy tx cleanups Pavel Begunkov
2024-06-27 12:59 ` [PATCH net-next 1/5] net: always try to set ubuf in skb_zerocopy_iter_stream Pavel Begunkov
2024-06-28 17:03   ` Willem de Bruijn
2024-06-27 12:59 ` [PATCH net-next 2/5] net: split __zerocopy_sg_from_iter() Pavel Begunkov
2024-06-28 17:03   ` Willem de Bruijn
2024-06-27 12:59 ` [PATCH net-next 3/5] net: batch zerocopy_fill_skb_from_iter accounting Pavel Begunkov
2024-06-28 17:06   ` Willem de Bruijn
2024-07-01 11:11     ` Pavel Begunkov
2024-07-01 18:27       ` Willem de Bruijn
2024-06-27 12:59 ` [PATCH net-next 4/5] io_uring/net: move charging socket out of zc io_uring Pavel Begunkov
2024-06-28 17:06   ` Willem de Bruijn
2024-06-27 12:59 ` Pavel Begunkov [this message]
2024-06-28 17:07   ` [PATCH net-next 5/5] net: limit scope of a skb_zerocopy_iter_stream var Willem de Bruijn
2024-06-28 17:09 ` [PATCH net-next 0/5] zerocopy tx cleanups Jens Axboe
2024-07-02 10:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3f4a39b3966204f062200caad857ff822f9f2895.1719190216.git.asml.silence@gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox