]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/netfilter/x_tables.c
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[karo-tx-linux.git] / net / netfilter / x_tables.c
index f134d384852ff2e9795cb8108b1387cfb3966f73..8876b7da6884c210393d1988032cbb5bd7018507 100644 (file)
@@ -763,17 +763,8 @@ EXPORT_SYMBOL(xt_check_entry_offsets);
  */
 unsigned int *xt_alloc_entry_offsets(unsigned int size)
 {
-       unsigned int *off;
+       return kvmalloc_array(size, sizeof(unsigned int), GFP_KERNEL | __GFP_ZERO);
 
-       off = kcalloc(size, sizeof(unsigned int), GFP_KERNEL | __GFP_NOWARN);
-
-       if (off)
-               return off;
-
-       if (size < (SIZE_MAX / sizeof(unsigned int)))
-               off = vmalloc(size * sizeof(unsigned int));
-
-       return off;
 }
 EXPORT_SYMBOL(xt_alloc_entry_offsets);
 
@@ -1007,8 +998,7 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size)
        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 | __GFP_HIGHMEM,
+               info = __vmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY,
                                 PAGE_KERNEL);
                if (!info)
                        return NULL;
@@ -1116,7 +1106,7 @@ static int xt_jumpstack_alloc(struct xt_table_info *i)
 
        size = sizeof(void **) * nr_cpu_ids;
        if (size > PAGE_SIZE)
-               i->jumpstack = vzalloc(size);
+               i->jumpstack = kvzalloc(size, GFP_KERNEL);
        else
                i->jumpstack = kzalloc(size, GFP_KERNEL);
        if (i->jumpstack == NULL)
@@ -1138,12 +1128,8 @@ static int xt_jumpstack_alloc(struct xt_table_info *i)
         */
        size = sizeof(void *) * i->stacksize * 2u;
        for_each_possible_cpu(cpu) {
-               if (size > PAGE_SIZE)
-                       i->jumpstack[cpu] = vmalloc_node(size,
-                               cpu_to_node(cpu));
-               else
-                       i->jumpstack[cpu] = kmalloc_node(size,
-                               GFP_KERNEL, cpu_to_node(cpu));
+               i->jumpstack[cpu] = kvmalloc_node(size, GFP_KERNEL,
+                       cpu_to_node(cpu));
                if (i->jumpstack[cpu] == NULL)
                        /*
                         * Freeing will be done later on by the callers. The