Netdev List
 help / color / mirror / Atom feed
* [PATCH] tcp: fix error return code in tcp_xmit_probe_skb
@ 2022-04-14  1:58 Hongbin Wang
  2022-04-14  2:15 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Hongbin Wang @ 2022-04-14  1:58 UTC (permalink / raw)
  To: edumazet, davem, yoshfuji, dsahern, kuba, pabeni
  Cc: ast, daniel, andrii, kafai, songliubraving, yhs, john.fastabend,
	kpsingh, netdev, linux-kernel, bpf

When alloc_skb failed, should return ENOMEM

Signed-off-by: Hongbin Wang <wh_bin@126.com>
---
 net/ipv4/tcp_output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index c221f3bce975..b97c85814d9c 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -3996,7 +3996,7 @@ static int tcp_xmit_probe_skb(struct sock *sk, int urgent, int mib)
 	skb = alloc_skb(MAX_TCP_HEADER,
 			sk_gfp_mask(sk, GFP_ATOMIC | __GFP_NOWARN));
 	if (!skb)
-		return -1;
+		return -ENOMEM;
 
 	/* Reserve space for headers and set control bits. */
 	skb_reserve(skb, MAX_TCP_HEADER);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tcp: fix error return code in tcp_xmit_probe_skb
  2022-04-14  1:58 [PATCH] tcp: fix error return code in tcp_xmit_probe_skb Hongbin Wang
@ 2022-04-14  2:15 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2022-04-14  2:15 UTC (permalink / raw)
  To: Hongbin Wang
  Cc: David Miller, Hideaki YOSHIFUJI, David Ahern, Jakub Kicinski,
	Paolo Abeni, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, netdev, LKML, bpf

On Wed, Apr 13, 2022 at 6:58 PM Hongbin Wang <wh_bin@126.com> wrote:
>
> When alloc_skb failed, should return ENOMEM


Can you explain which rule mandates this statement ?

The only caller that propagates this error has other "return -1;"

The precise value of the error, we do not care, as long it is negative.

To be clear, this error code is not propagated to user space, so this
patch only adds code churn.


>
>
> Signed-off-by: Hongbin Wang <wh_bin@126.com>
> ---
>  net/ipv4/tcp_output.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index c221f3bce975..b97c85814d9c 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -3996,7 +3996,7 @@ static int tcp_xmit_probe_skb(struct sock *sk, int urgent, int mib)
>         skb = alloc_skb(MAX_TCP_HEADER,
>                         sk_gfp_mask(sk, GFP_ATOMIC | __GFP_NOWARN));
>         if (!skb)
> -               return -1;
> +               return -ENOMEM;
>
>         /* Reserve space for headers and set control bits. */
>         skb_reserve(skb, MAX_TCP_HEADER);
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-14  2:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-14  1:58 [PATCH] tcp: fix error return code in tcp_xmit_probe_skb Hongbin Wang
2022-04-14  2:15 ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox