Thread (2 messages) 2 messages, 2 authors, 2019-08-22
STALE2518d

[PATCH] net/ipv4/tcp_bpf: Delete an unnecessary check before the function call “consume_skb”

From: Markus Elfring <hidden>
Date: 2019-08-22 16:32:59
Also in: bpf, kernel-janitors, lkml
Subsystem: bpf [l7 framework] (sockmap), networking [general], networking [tcp], the rest · Maintainers: John Fastabend, Jakub Sitnicki, Jiayuan Chen, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Neal Cardwell, Linus Torvalds

From: Markus Elfring <redacted>
Date: Thu, 22 Aug 2019 18:20:42 +0200

The consume_skb() function performs also input parameter validation.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <redacted>
---
 net/ipv4/tcp_bpf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c
index 8a56e09cfb0e..4ae18bd431a0 100644
--- a/net/ipv4/tcp_bpf.c
+++ b/net/ipv4/tcp_bpf.c
@@ -103,8 +103,7 @@ int __tcp_bpf_recvmsg(struct sock *sk, struct sk_psock *psock,
 		msg_rx->sg.start = i;
 		if (!sge->length && msg_rx->sg.start == msg_rx->sg.end) {
 			list_del(&msg_rx->list);
-			if (msg_rx->skb)
-				consume_skb(msg_rx->skb);
+			consume_skb(msg_rx->skb);
 			kfree(msg_rx);
 		}
 		msg_rx = list_first_entry_or_null(&psock->ingress_msg,
--
2.23.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help