File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 18
18
#define pr_fmt (fmt ) KBUILD_MODNAME ": " fmt
19
19
20
20
#include <linux/slab.h>
21
+ #include <linux/kmemleak.h>
21
22
#include <linux/types.h>
22
23
#include <linux/kernel.h>
23
24
#include <linux/module.h>
@@ -443,12 +444,14 @@ static struct neigh_hash_table *neigh_hash_alloc(unsigned int shift)
443
444
ret = kmalloc (sizeof (* ret ), GFP_ATOMIC );
444
445
if (!ret )
445
446
return NULL ;
446
- if (size <= PAGE_SIZE )
447
+ if (size <= PAGE_SIZE ) {
447
448
buckets = kzalloc (size , GFP_ATOMIC );
448
- else
449
+ } else {
449
450
buckets = (struct neighbour __rcu * * )
450
451
__get_free_pages (GFP_ATOMIC | __GFP_ZERO ,
451
452
get_order (size ));
453
+ kmemleak_alloc (buckets , size , 0 , GFP_ATOMIC );
454
+ }
452
455
if (!buckets ) {
453
456
kfree (ret );
454
457
return NULL ;
@@ -468,10 +471,12 @@ static void neigh_hash_free_rcu(struct rcu_head *head)
468
471
size_t size = (1 << nht -> hash_shift ) * sizeof (struct neighbour * );
469
472
struct neighbour __rcu * * buckets = nht -> hash_buckets ;
470
473
471
- if (size <= PAGE_SIZE )
474
+ if (size <= PAGE_SIZE ) {
472
475
kfree (buckets );
473
- else
476
+ } else {
477
+ kmemleak_free (buckets );
474
478
free_pages ((unsigned long )buckets , get_order (size ));
479
+ }
475
480
kfree (nht );
476
481
}
477
482
You can’t perform that action at this time.
0 commit comments