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 |
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 --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);
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(-)