Commit 2ca58ed2 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Paolo Abeni
Browse files

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: default avatarPavel Begunkov <asml.silence@gmail.com>
Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
Reviewed-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 060f4ba6
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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.