Skip to contentSkip to conversation

ipv6: remove useless assignment to newinet in tcp_v6_syn_recv_sock()

PATCH In review Nghia Le 2 participants 3 messages Nov 3, 2021 – Nov 4, 2021

Subsystems (2)
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 starting from checking condition of protocol to exiting by returning newsk structure. Along the code path, newinet is never read. Thus, assignment to newinet is wredundant 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
#1 lore raw
Quoted 6 lines · Nghia Le

The newinet value is initialized with inet_sk() in a block code starting from checking condition of protocol to exiting by returning newsk structure. Along the code path, newinet is never read. Thus, assignment to newinet is wredundant and can be removed.

Just a bit improving your English:

s/in a block code starting from checking condition of protocol to exiting by returning newsk structure/in a block code to handle sockets for the ETH_P_IP protocol/

s/Along the code path/Along this code path/

s/wredundant/redundant/

I would prefer "needless" or "useless" to "redundant", but all words are okay.

Lukas

Quoted 20 lines
---
 net/ipv6/tcp_ipv6.c | 1 -
 1 file changed, 1 deletion(-)
net/ipv6/tcp_ipv6.c +0 -2
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);
 
--

2.25.1

author
#2 lore raw
Quoted 35 lines · Lukas Bulwahn
Quoted 6 lines · Nghia Le

The newinet value is initialized with inet_sk() in a block code starting from checking condition of protocol to exiting by returning newsk structure. Along the code path, newinet is never read. Thus, assignment to newinet is wredundant and can be removed.

Just a bit improving your English:

s/in a block code starting from checking condition of protocol to exiting by returning newsk structure/in a block code to handle sockets for the ETH_P_IP protocol/

s/Along the code path/Along this code path/

s/wredundant/redundant/

I would prefer "needless" or "useless" to "redundant", but all words are okay.

Lukas

Quoted 13 lines
---
 net/ipv6/tcp_ipv6.c | 1 -
 1 file changed, 1 deletion(-)
net/ipv6/tcp_ipv6.c +0 -0
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);
 
Quoted 7 lines
Quoted 7 lines
net/ipv6/tcp_ipv6.c +0 -2
-               newinet = inet_sk(newsk);
                newnp = tcp_inet6_sk(newsk);
                newtp = tcp_sk(newsk);
 
--

2.25.1

Thanks Lukas, I revised and submitted patch to public mailing list. Best regards,
Nghia Le

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#263): https://lists.elisa.tech/g/linux-safety/message/263
Mute This Topic: https://lists.elisa.tech/mt/86805127/5278000
Group Owner: [email protected]
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-