genetlink: Fix off-by-one in genl_allocate_reserve_groups()
authorDavid S. Miller <davem@davemloft.net>
Wed, 13 Jan 2016 15:28:06 +0000 (10:28 -0500)
committerDavid S. Miller <davem@davemloft.net>
Wed, 13 Jan 2016 15:28:06 +0000 (10:28 -0500)
The bug fix for adding n_groups to the computation forgot
to adjust ">=" to ">" to keep the condition correct.

Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/genetlink.c

index d3f6b063467ba94d480230e2512ce2074d04125f..f830326b3b1dbaf63e727e7a4f4f496d5108db64 100644 (file)
@@ -185,7 +185,7 @@ static int genl_allocate_reserve_groups(int n_groups, int *first_id)
                        }
                }
 
-               if (id + n_groups >= mc_groups_longs * BITS_PER_LONG) {
+               if (id + n_groups > mc_groups_longs * BITS_PER_LONG) {
                        unsigned long new_longs = mc_groups_longs +
                                                  BITS_TO_LONGS(n_groups);
                        size_t nlen = new_longs * sizeof(unsigned long);