diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2024-06-27 13:59:45 +0100 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2024-07-02 12:06:50 +0200 |
commit | 2ca58ed21cefdda45520a0a2b1980c008efe9874 (patch) | |
tree | 49d28d7d73115a7f25d5e52cac07fda75a117dbd | |
parent | 060f4ba6e40338a70932603a3564903acf5f5734 (diff) | |
download | lwn-2ca58ed21cefdda45520a0a2b1980c008efe9874.tar.gz lwn-2ca58ed21cefdda45520a0a2b1980c008efe9874.zip |
net: limit scope of a skb_zerocopy_iter_stream var
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 <asml.silence@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r-- | net/core/skbuff.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 52986e1ce13e..0ed4d00d258c 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -1871,7 +1871,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) { @@ -1879,6 +1878,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. |