Skip to content

Commit 4e43df3

Browse files
holtmanndavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 88ef66a commit 4e43df3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/netlink/genetlink.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ int genl_register_family(struct genl_family *family)
362362
} else
363363
family->attrbuf = NULL;
364364

365-
family->id = idr_alloc(&genl_fam_idr, family,
366-
start, end + 1, GFP_KERNEL);
365+
family->id = idr_alloc_cyclic(&genl_fam_idr, family,
366+
start, end + 1, GFP_KERNEL);
367367
if (family->id < 0) {
368368
err = family->id;
369369
goto errout_free;

0 commit comments

Comments
 (0)