summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2019-04-24 23:18:53 +0300
committerDavid S. Miller <davem@davemloft.net>2019-04-26 18:59:58 +0300
commit4e43df38a2e6c876d3c8ecc4196ed67a895c425d (patch)
tree766d8b19f5cbd48926efce04fda517e1554b8ad8 /net
parent88ef66a28391ea7b624bfb7508a5b015c13b28f3 (diff)
downloadlinux-4e43df38a2e6c876d3c8ecc4196ed67a895c425d.tar.xz
genetlink: use idr_alloc_cyclic for family->id assignment
When allocating the next family->id it makes more sense to use idr_alloc_cyclic to avoid re-using a previously used family->id as much as possible. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/netlink/genetlink.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index f0ec068e1d02..cb69d35c8e6a 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -362,8 +362,8 @@ int genl_register_family(struct genl_family *family)
} else
family->attrbuf = NULL;
- family->id = idr_alloc(&genl_fam_idr, family,
- start, end + 1, GFP_KERNEL);
+ family->id = idr_alloc_cyclic(&genl_fam_idr, family,
+ start, end + 1, GFP_KERNEL);
if (family->id < 0) {
err = family->id;
goto errout_free;