Re: [PATCH] net/core/neighbour: tell kmemleak about hash tables

From: Cong Wang
Date: Thu Jan 10 2019 - 13:10:08 EST


On Tue, Jan 8, 2019 at 1:30 AM Konstantin Khlebnikov
<khlebnikov@xxxxxxxxxxxxxx> wrote:
> @@ -443,12 +444,14 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift)
> ret = kmalloc(sizeof(*ret), GFP_ATOMIC);
> if (!ret)
> return NULL;
> - if (size <= PAGE_SIZE)
> + if (size <= PAGE_SIZE) {
> buckets = kzalloc(size, GFP_ATOMIC);
> - else
> + } else {
> buckets = (struct neighbour __rcu **)
> __get_free_pages(GFP_ATOMIC | __GFP_ZERO,
> get_order(size));
> + kmemleak_alloc(buckets, size, 0, GFP_ATOMIC);

Why min_count is 0 rather than 1 here?