net/netfilter/x_tables.c: use kvmalloc() in xt_alloc_table_info()
Subsystems (2)
PATCH 52/96 net/netfilter/x_tables.c: use kvmalloc() in xt_alloc_table_info()
From: Michal Hocko <[email protected]>
Subject: net/netfilter/x_tables.c: use kvmalloc() in xt_alloc_table_info()
xt_alloc_table_info() basically opencodes kvmalloc() so use the library function instead.
Signed-off-by Michal Hocko <[email protected]>
Cc Pablo Neira Ayuso <[email protected]>
Cc Jozsef Kadlecsik <[email protected]>
Cc Florian Westphal <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
net/netfilter/x_tables.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
net/netfilter/x_tables.c renamed from net/netfilter/x_tables.c~netfilter-use-kvmalloc-xt_alloc_table_info +4 -8
@@ -1003,14 +1003,10 @@ struct xt_table_info *xt_alloc_table_infif ((SMP_ALIGN (size) >>PAGE_SHIFT ) +2 > totalram_pages)return NULL ; -if (sz <= (PAGE_SIZE <<PAGE_ALLOC_COSTLY_ORDER )) - info =kmalloc (sz,GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY); -if (!info) { - info =__vmalloc (sz,GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY, -PAGE_KERNEL ); -if (!info) -return NULL ; - } + info =kvmalloc (sz,GFP_KERNEL ); +if (!info) +return NULL ; +memset (info,0 ,sizeof (*info)); info->size = size;return info;
_