Subject: Re: [PATCH net-next] tcp: Change return value of tcp_rcv_established()

From: Daniel Borkmann <[email-masked]>
Date: Sat, 31 Aug 2013 11:28:12 +0200

On 08/30/2013 08:03 AM, Vijay Subramanian wrote:
> tcp_rcv_established() returns only one value namely 0. We change the return
> value to void (as suggested by David Miller).
>
> After commit 0c24604b (tcp: implement RFC 5961 4.2), we no longer send RSTs in
> response to SYNs. We can remove the check and processing on the return value of
> tcp_rcv_established().
>
> We also fix jtcp_rcv_established() in tcp_probe.c to match that of
> tcp_rcv_established().
>
> Signed-off-by: Vijay Subramanian <[email-masked]>
> ---
> Changes: Earlier patch titled "tcp: Remove needless check of return value"
> fixed only the second issue above.
>
[...]
>
>   csum_error:
>   	TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_CSUMERRORS);
> @@ -5260,7 +5260,7 @@ csum_error:
>
>   discard:
>   	__kfree_skb(skb);
> -	return 0;
> +	return;
>   }
>   EXPORT_SYMBOL(tcp_rcv_established);

You can remove this return here in discard case.

[...]
> diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c
> index 622a437..8b10379 100644
> --- a/net/ipv4/tcp_probe.c
> +++ b/net/ipv4/tcp_probe.c
> @@ -122,7 +122,7 @@ static inline int tcp_probe_avail(void)
>    * Hook inserted to be called before each receive packet.
>    * Note: arguments must match tcp_rcv_established()!
>    */
> -static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb,
> +static void jtcp_rcv_established(struct sock *sk, struct sk_buff *skb,
>   				const struct tcphdr *th, unsigned int len)

Also, you should align the second line here to match opening '('.

>   {
>   	const struct tcp_sock *tp = tcp_sk(sk);
> @@ -172,7 +172,7 @@ static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb,
>   	}
>
>   	jprobe_return();
> -	return 0;
> +	return;

This return can then be removed if it's void anyway.

>   }
[...]