diff mbox series

[net-next] net: core: Return the correct errno code

Message ID 20210204031923.15264-1-zhengyongjun3@huawei.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: core: Return the correct errno code | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 10 maintainers not CCed: chenweilong@huawei.com toke@redhat.com nikolay@nvidia.com zhudi21@huawei.com jwi@linux.ibm.com edumazet@google.com ast@kernel.org roopa@cumulusnetworks.com laniel_francis@privacyrequired.com xiyou.wangcong@gmail.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Zheng Yongjun Feb. 4, 2021, 3:19 a.m. UTC
When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.

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

Comments

Jakub Kicinski Feb. 6, 2021, 7:20 p.m. UTC | #1
On Thu, 4 Feb 2021 11:19:23 +0800 Zheng Yongjun wrote:
> When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.
> 
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
>  net/core/rtnetlink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 7d7223691783..6df8fb25668b 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -177,7 +177,7 @@ static int rtnl_register_internal(struct module *owner,
>  	struct rtnl_link *link, *old;
>  	struct rtnl_link __rcu **tab;
>  	int msgindex;
> -	int ret = -ENOBUFS;
> +	int ret = -ENOMEM;

while at it please move the line above int msgindex; so that variable
lines are sorted longest to shortest.

>  	BUG_ON(protocol < 0 || protocol > RTNL_FAMILY_MAX);
>  	msgindex = rtm_msgindex(msgtype);
diff mbox series

Patch

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 7d7223691783..6df8fb25668b 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -177,7 +177,7 @@  static int rtnl_register_internal(struct module *owner,
 	struct rtnl_link *link, *old;
 	struct rtnl_link __rcu **tab;
 	int msgindex;
-	int ret = -ENOBUFS;
+	int ret = -ENOMEM;
 
 	BUG_ON(protocol < 0 || protocol > RTNL_FAMILY_MAX);
 	msgindex = rtm_msgindex(msgtype);