[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e8ca5cebbee024a6158ca5d1c9cc65bc8971c987.1648981571.git.asml.silence@gmail.com>
Date: Sun, 3 Apr 2022 14:06:16 +0100
From: Pavel Begunkov <asml.silence@...il.com>
To: netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: Eric Dumazet <edumazet@...gle.com>, Wei Liu <wei.liu@...nel.org>,
Paul Durrant <paul@....org>,
Pavel Begunkov <asml.silence@...il.com>
Subject: [PATCH net-next 04/27] skbuff: drop zero check from skb_zcopy_set
Only two skb_zcopy_set() callers may pass a null skb, so kill a null
check from the function, which can't be easily compiled out and hand
code where needed. This will also help with further patches.
Signed-off-by: Pavel Begunkov <asml.silence@...il.com>
---
include/linux/skbuff.h | 2 +-
net/ipv4/ip_output.c | 3 ++-
net/ipv6/ip6_output.c | 3 ++-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 3a30cae8b0a5..f5de5c9cc3da 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1679,7 +1679,7 @@ static inline void skb_zcopy_init(struct sk_buff *skb, struct ubuf_info *uarg)
static inline void skb_zcopy_set(struct sk_buff *skb, struct ubuf_info *uarg,
bool *have_ref)
{
- if (skb && uarg && !skb_zcopy(skb)) {
+ if (uarg && !skb_zcopy(skb)) {
if (unlikely(have_ref && *have_ref))
*have_ref = false;
else
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 00b4bf26fd93..f864b8c48e42 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1027,7 +1027,8 @@ static int __ip_append_data(struct sock *sk,
paged = true;
} else {
uarg->zerocopy = 0;
- skb_zcopy_set(skb, uarg, &extra_uref);
+ if (skb)
+ skb_zcopy_set(skb, uarg, &extra_uref);
}
}
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index e23f058166af..e9b039f56637 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1529,7 +1529,8 @@ static int __ip6_append_data(struct sock *sk,
paged = true;
} else {
uarg->zerocopy = 0;
- skb_zcopy_set(skb, uarg, &extra_uref);
+ if (skb)
+ skb_zcopy_set(skb, uarg, &extra_uref);
}
}
--
2.35.1
Powered by blists - more mailing lists