netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yongjun <weiyj.lk@gmail.com>
To: stephen hemminger <stephen@networkplumber.org>,
	Matti Vaittinen <matti.vaittinen@nokia.com>,
	Tom Herbert <tom@herbertland.com>,
	Johannes Berg <johannes.berg@intel.com>,
	pravin shelar <pshelar@ovn.org>,
	Tycho Andersen <tycho.andersen@canonical.com>,
	Florian Westphal <fw@strlen.de>
Cc: Wei Yongjun <weiyongjun1@huawei.com>, netdev@vger.kernel.org
Subject: [PATCH net-next] genetlink: fix error return code in genl_register_family()
Date: Mon, 31 Oct 2016 14:53:03 +0000	[thread overview]
Message-ID: <1477925583-7956-1-git-send-email-weiyj.lk@gmail.com> (raw)

From: Wei Yongjun <weiyongjun1@huawei.com>

Fix to return error code -ENOMEM from the idr_alloc() error handling
case instead of 0, as done elsewhere in this function.

Fixes: 2ae0f17df1cd ("genetlink: use idr to track families")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 net/netlink/genetlink.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index caf04d7..305730d 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -362,8 +362,10 @@ int genl_register_family(struct genl_family *family)
 
 	family->id = idr_alloc(&genl_fam_idr, family,
 			       start, end + 1, GFP_KERNEL);
-	if (!family->id)
+	if (!family->id) {
+		err = -ENOMEM;
 		goto errout_locked;
+	}
 
 	err = genl_validate_assign_mc_groups(family);
 	if (err)

             reply	other threads:[~2016-10-31 14:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-31 14:53 Wei Yongjun [this message]
2016-10-31 20:29 ` [PATCH net-next] genetlink: fix error return code in genl_register_family() David Miller
2016-11-01 14:45 ` [PATCH net-next v2] " Wei Yongjun
2016-11-01 16:13   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477925583-7956-1-git-send-email-weiyj.lk@gmail.com \
    --to=weiyj.lk@gmail.com \
    --cc=fw@strlen.de \
    --cc=johannes.berg@intel.com \
    --cc=matti.vaittinen@nokia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@ovn.org \
    --cc=stephen@networkplumber.org \
    --cc=tom@herbertland.com \
    --cc=tycho.andersen@canonical.com \
    --cc=weiyongjun1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).