Merge tag 'backlight-for-linus-4.2' of git://git.kernel.org/pub/scm/linux/kernel...
[deliverable/linux.git] / net / netfilter / x_tables.c
index 51a459c3c6490cb7ce5080c5aa147920077dc9d5..d324fe71260c9f24b02507e4f429c0ba1e328d98 100644 (file)
@@ -658,35 +658,23 @@ EXPORT_SYMBOL_GPL(xt_compat_target_to_user);
 
 struct xt_table_info *xt_alloc_table_info(unsigned int size)
 {
-       struct xt_table_info *newinfo;
-       int cpu;
+       struct xt_table_info *info = NULL;
+       size_t sz = sizeof(*info) + size;
 
        /* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */
        if ((SMP_ALIGN(size) >> PAGE_SHIFT) + 2 > totalram_pages)
                return NULL;
 
-       newinfo = kzalloc(XT_TABLE_INFO_SZ, GFP_KERNEL);
-       if (!newinfo)
-               return NULL;
-
-       newinfo->size = size;
-
-       for_each_possible_cpu(cpu) {
-               if (size <= PAGE_SIZE)
-                       newinfo->entries[cpu] = kmalloc_node(size,
-                                                       GFP_KERNEL,
-                                                       cpu_to_node(cpu));
-               else
-                       newinfo->entries[cpu] = vmalloc_node(size,
-                                                       cpu_to_node(cpu));
-
-               if (newinfo->entries[cpu] == NULL) {
-                       xt_free_table_info(newinfo);
+       if (sz <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER))
+               info = kmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
+       if (!info) {
+               info = vmalloc(sz);
+               if (!info)
                        return NULL;
-               }
        }
-
-       return newinfo;
+       memset(info, 0, sizeof(*info));
+       info->size = size;
+       return info;
 }
 EXPORT_SYMBOL(xt_alloc_table_info);
 
@@ -694,9 +682,6 @@ void xt_free_table_info(struct xt_table_info *info)
 {
        int cpu;
 
-       for_each_possible_cpu(cpu)
-               kvfree(info->entries[cpu]);
-
        if (info->jumpstack != NULL) {
                for_each_possible_cpu(cpu)
                        kvfree(info->jumpstack[cpu]);
@@ -705,7 +690,7 @@ void xt_free_table_info(struct xt_table_info *info)
 
        free_percpu(info->stackptr);
 
-       kfree(info);
+       kvfree(info);
 }
 EXPORT_SYMBOL(xt_free_table_info);
 
@@ -947,11 +932,9 @@ static int xt_table_seq_show(struct seq_file *seq, void *v)
 {
        struct xt_table *table = list_entry(v, struct xt_table, list);
 
-       if (strlen(table->name)) {
+       if (*table->name)
                seq_printf(seq, "%s\n", table->name);
-               return seq_has_overflowed(seq);
-       } else
-               return 0;
+       return 0;
 }
 
 static const struct seq_operations xt_table_seq_ops = {
@@ -1087,10 +1070,8 @@ static int xt_match_seq_show(struct seq_file *seq, void *v)
                if (trav->curr == trav->head)
                        return 0;
                match = list_entry(trav->curr, struct xt_match, list);
-               if (*match->name == '\0')
-                       return 0;
-               seq_printf(seq, "%s\n", match->name);
-               return seq_has_overflowed(seq);
+               if (*match->name)
+                       seq_printf(seq, "%s\n", match->name);
        }
        return 0;
 }
@@ -1142,10 +1123,8 @@ static int xt_target_seq_show(struct seq_file *seq, void *v)
                if (trav->curr == trav->head)
                        return 0;
                target = list_entry(trav->curr, struct xt_target, list);
-               if (*target->name == '\0')
-                       return 0;
-               seq_printf(seq, "%s\n", target->name);
-               return seq_has_overflowed(seq);
+               if (*target->name)
+                       seq_printf(seq, "%s\n", target->name);
        }
        return 0;
 }
This page took 0.038697 seconds and 5 git commands to generate.