Re: [PATCH] ipv6: remove useless assignment to newinet in tcp_v6_syn_recv_sock()

Lukas Bulwahn <[email protected]> Thu, 4 Nov 2021 07:50:18 +0100
Newsgroups tech.elisa.lists.linux-safety
Message-ID <CAKXUXMx9kvY7g8VRsNfZPZ-8=EpCoGOsK7igHqjNQfJO4UwGBA@mail.gmail.com>
On Thu, Nov 4, 2021 at 12:28 AM Nghia Le <[email protected]> wrote:
>
> 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

> Signed-off-by: Nghia Le <[email protected]>
> ---
>  net/ipv6/tcp_ipv6.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
> index 2cc9b0e53ad1..551fce49841d 100644
> --- a/net/ipv6/tcp_ipv6.c
> +++ b/net/ipv6/tcp_ipv6.c
> @@ -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
>