netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ipv4: Return the correct errno code
@ 2021-02-04  7:26 Zheng Yongjun
  2021-02-06 19:19 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Zheng Yongjun @ 2021-02-04  7:26 UTC (permalink / raw)
  To: davem, kuznet, yoshfuji, kuba, netdev, linux-kernel; +Cc: Zheng Yongjun

When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.

Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
 net/ipv4/devinet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 123a6d39438f..fa586e915621 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -2582,7 +2582,7 @@ static int __devinet_sysctl_register(struct net *net, char *dev_name,
 free:
 	kfree(t);
 out:
-	return -ENOBUFS;
+	return -ENOMEM;
 }
 
 static void __devinet_sysctl_unregister(struct net *net,
-- 
2.22.0


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

* Re: [PATCH net-next] net: ipv4: Return the correct errno code
  2021-02-04  7:26 [PATCH net-next] net: ipv4: Return the correct errno code Zheng Yongjun
@ 2021-02-06 19:19 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2021-02-06 19:19 UTC (permalink / raw)
  To: Zheng Yongjun; +Cc: davem, kuznet, yoshfuji, netdev, linux-kernel

On Thu, 4 Feb 2021 15:26:57 +0800 Zheng Yongjun wrote:
> When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.
> 
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
>  net/ipv4/devinet.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index 123a6d39438f..fa586e915621 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -2582,7 +2582,7 @@ static int __devinet_sysctl_register(struct net *net, char *dev_name,
>  free:
>  	kfree(t);
>  out:
> -	return -ENOBUFS;
> +	return -ENOMEM;

But this path also gets hit when registration fails.
Are you sure registration also only fails when there is no memory?

>  }
>  
>  static void __devinet_sysctl_unregister(struct net *net,


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

end of thread, other threads:[~2021-02-06 19:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04  7:26 [PATCH net-next] net: ipv4: Return the correct errno code Zheng Yongjun
2021-02-06 19:19 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).