Skip to content

Commit b9e0102

Browse files
JoePerchesummakynes
authored andcommitted
netfilter: Use kvcalloc
Convert the uses of kvmalloc_array with __GFP_ZERO to the equivalent kvcalloc. Signed-off-by: Joe Perches <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 5038517 commit b9e0102

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

net/netfilter/nf_conntrack_core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,8 +2248,7 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls)
22482248
BUILD_BUG_ON(sizeof(struct hlist_nulls_head) != sizeof(struct hlist_head));
22492249
nr_slots = *sizep = roundup(*sizep, PAGE_SIZE / sizeof(struct hlist_nulls_head));
22502250

2251-
hash = kvmalloc_array(nr_slots, sizeof(struct hlist_nulls_head),
2252-
GFP_KERNEL | __GFP_ZERO);
2251+
hash = kvcalloc(nr_slots, sizeof(struct hlist_nulls_head), GFP_KERNEL);
22532252

22542253
if (hash && nulls)
22552254
for (i = 0; i < nr_slots; i++)

net/netfilter/x_tables.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -939,14 +939,14 @@ EXPORT_SYMBOL(xt_check_entry_offsets);
939939
*
940940
* @size: number of entries
941941
*
942-
* Return: NULL or kmalloc'd or vmalloc'd array
942+
* Return: NULL or zeroed kmalloc'd or vmalloc'd array
943943
*/
944944
unsigned int *xt_alloc_entry_offsets(unsigned int size)
945945
{
946946
if (size > XT_MAX_TABLE_SIZE / sizeof(unsigned int))
947947
return NULL;
948948

949-
return kvmalloc_array(size, sizeof(unsigned int), GFP_KERNEL | __GFP_ZERO);
949+
return kvcalloc(size, sizeof(unsigned int), GFP_KERNEL);
950950

951951
}
952952
EXPORT_SYMBOL(xt_alloc_entry_offsets);

0 commit comments

Comments
 (0)