fib_hash: kmalloc + memset conversion to kzalloc
Subsystems (3)
PATCH 3/4 fib_hash: kmalloc + memset conversion to kzalloc
fib_hash: kmalloc + memset conversion to kzalloc
Signed-off-by Joonwoo Park <[email protected]>
Thanks.
Joonwoo
---
net/ipv4/fib_hash.c +6 -5
@@ -102,10 +102,14 @@ static struct hlist_head *fz_hash_alloc(int divisor)unsigned long size = divisor *sizeof (struct hlist_head );if (size <=PAGE_SIZE ) { -return kmalloc (size,GFP_KERNEL ); +return kzalloc (size,GFP_KERNEL ); }else { -return (struct hlist_head *) +struct hlist_head *hash; + hash = (struct hlist_head *)__get_free_pages (GFP_KERNEL ,get_order (size)); +if (hash) +memset (hash,0 , size); +return hash; } }
@@ -174,8 +178,6 @@ static void fn_rehash_zone(struct fn_zone *fz) ht =fz_hash_alloc (new_divisor);if (ht) { -memset (ht,0 , new_divisor *sizeof (struct hlist_head )); -write_lock_bh (&fib_hash_lock); old_ht = fz->fz_hash; fz->fz_hash = ht;
@@ -219,7 +221,6 @@ fn_new_zone(struct fn_hash *table, int z)kfree (fz);return NULL ; } -memset (fz->fz_hash,0 , fz->fz_divisor *sizeof (struct hlist_head *)); fz->fz_order = z; fz->fz_mask =inet_make_mask (z);
---