Skip to contentSkip to conversation

ipv6: remove useless assignment to newinet in tcp_v6_syn_recv_sock()

PATCH Applied Nghia Le 3 participants 4 messages Nov 4, 2021 – Nov 6, 2021

Subsystems (5)
lore
Share & tools
lore

Nghia Le

author
#0 lore raw

PATCH 1/1 ipv6: remove useless assignment to newinet in tcp_v6_syn_recv_sock()

The newinet value is initialized with inet_sk() in a block code to handle sockets for the ETH_P_IP protocol. Along this code path, newinet is never read. Thus, assignment to newinet is needless and can be removed.

---
 net/ipv6/tcp_ipv6.c | 1 -
 1 file changed, 1 deletion(-)
net/ipv6/tcp_ipv6.c +0 -1
index 2cc9b0e53ad1..551fce49841d 100644
@@ -1263,7 +1263,6 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *
 
 		inet_sk(newsk)->pinet6 = tcp_inet6_sk(newsk);
 
-		newinet = inet_sk(newsk);
 		newnp = tcp_inet6_sk(newsk);
 		newtp = tcp_sk(newsk);
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Nghia Le

The newinet value is initialized with inet_sk() in a block code to handle sockets for the ETH_P_IP protocol. Along this code path, newinet is never read. Thus, assignment to newinet is needless and can be removed.

---
 net/ipv6/tcp_ipv6.c | 1 -
 1 file changed, 1 deletion(-)
net/ipv6/tcp_ipv6.c +0 -0
index 2cc9b0e53ad1..551fce49841d 100644

net/ipv6/tcp_ipv6.c static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff * · line 1268

Quoted 7 lines
net/ipv6/tcp_ipv6.c +0 -1
@@ -1263,7 +1263,6 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *
 
 		inet_sk(newsk)->pinet6 = tcp_inet6_sk(newsk);
 
-		newinet = inet_sk(newsk);
 		newnp = tcp_inet6_sk(newsk);
 		newtp = tcp_sk(newsk);
 
#2 lore raw
In reply to Nghia Le
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 4 Nov 2021 21:37:40 +0700 you wrote:

The newinet value is initialized with inet_sk() in a block code to handle sockets for the ETH_P_IP protocol. Along this code path, newinet is never read. Thus, assignment to newinet is needless and can be removed.

[...]

Here is the summary with links:
- ipv6: remove useless assignment to newinet in tcp_v6_syn_recv_sock()

    https://git.kernel.org/netdev/net/c/70bf363d7adb

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#3 lore raw
In reply to Nghia Le
This patch was applied to bpf/bpf.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to bpf/bpf.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 4 Nov 2021 21:37:40 +0700 you wrote:

The newinet value is initialized with inet_sk() in a block code to handle sockets for the ETH_P_IP protocol. Along this code path, newinet is never read. Thus, assignment to newinet is needless and can be removed.

[...]

Here is the summary with links:
- ipv6: remove useless assignment to newinet in tcp_v6_syn_recv_sock()

    https://git.kernel.org/bpf/bpf/c/70bf363d7adb

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html