Commit b9e0102a authored by Joe Perches's avatar Joe Perches Committed by Pablo Neira Ayuso

netfilter: Use kvcalloc

Convert the uses of kvmalloc_array with __GFP_ZERO to
the equivalent kvcalloc.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 50385171
...@@ -2248,8 +2248,7 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls) ...@@ -2248,8 +2248,7 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls)
BUILD_BUG_ON(sizeof(struct hlist_nulls_head) != sizeof(struct hlist_head)); BUILD_BUG_ON(sizeof(struct hlist_nulls_head) != sizeof(struct hlist_head));
nr_slots = *sizep = roundup(*sizep, PAGE_SIZE / sizeof(struct hlist_nulls_head)); nr_slots = *sizep = roundup(*sizep, PAGE_SIZE / sizeof(struct hlist_nulls_head));
hash = kvmalloc_array(nr_slots, sizeof(struct hlist_nulls_head), hash = kvcalloc(nr_slots, sizeof(struct hlist_nulls_head), GFP_KERNEL);
GFP_KERNEL | __GFP_ZERO);
if (hash && nulls) if (hash && nulls)
for (i = 0; i < nr_slots; i++) for (i = 0; i < nr_slots; i++)
......
...@@ -939,14 +939,14 @@ EXPORT_SYMBOL(xt_check_entry_offsets); ...@@ -939,14 +939,14 @@ EXPORT_SYMBOL(xt_check_entry_offsets);
* *
* @size: number of entries * @size: number of entries
* *
* Return: NULL or kmalloc'd or vmalloc'd array * Return: NULL or zeroed kmalloc'd or vmalloc'd array
*/ */
unsigned int *xt_alloc_entry_offsets(unsigned int size) unsigned int *xt_alloc_entry_offsets(unsigned int size)
{ {
if (size > XT_MAX_TABLE_SIZE / sizeof(unsigned int)) if (size > XT_MAX_TABLE_SIZE / sizeof(unsigned int))
return NULL; return NULL;
return kvmalloc_array(size, sizeof(unsigned int), GFP_KERNEL | __GFP_ZERO); return kvcalloc(size, sizeof(unsigned int), GFP_KERNEL);
} }
EXPORT_SYMBOL(xt_alloc_entry_offsets); EXPORT_SYMBOL(xt_alloc_entry_offsets);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment