summaryrefslogtreecommitdiffstats
path: root/kernel/ip_set_core.c
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2011-01-26 23:47:20 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2011-01-26 23:47:20 +0100
commit1fd89ab65388aec6cb58ad50b2c543dd6c89087c (patch)
tree1430502d786584101b96648cac68c52158c8cb68 /kernel/ip_set_core.c
parent4348ddda619ef356085fd7faff598edd07f6d618 (diff)
Use vzalloc() instead of __vmalloc()
Use vzalloc() if kernel version supports it. (Eric Dumazet, Patrick McHardy)
Diffstat (limited to 'kernel/ip_set_core.c')
-rw-r--r--kernel/ip_set_core.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/kernel/ip_set_core.c b/kernel/ip_set_core.c
index 3dad957..4392680 100644
--- a/kernel/ip_set_core.c
+++ b/kernel/ip_set_core.c
@@ -17,6 +17,7 @@
#include <linux/spinlock.h>
#include <linux/netlink.h>
#include <linux/rculist.h>
+#include <linux/version.h>
#include <net/netlink.h>
#include <linux/netfilter.h>
@@ -193,20 +194,24 @@ EXPORT_SYMBOL_GPL(ip_set_type_unregister);
/* Utility functions */
void *
-ip_set_alloc(size_t size, gfp_t gfp_mask)
+ip_set_alloc(size_t size)
{
void *members = NULL;
if (size < KMALLOC_MAX_SIZE)
- members = kzalloc(size, gfp_mask | __GFP_NOWARN);
+ members = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
if (members) {
pr_debug("%p: allocated with kmalloc\n", members);
return members;
}
- members = __vmalloc(size, gfp_mask | __GFP_ZERO | __GFP_HIGHMEM,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
+ members = __vmalloc(size, GFP_KERNEL | __GFP_ZERO | __GFP_HIGHMEM,
PAGE_KERNEL);
+#else
+ members = vzalloc(size);
+#endif
if (!members)
return NULL;
pr_debug("%p: allocated with vmalloc\n", members);