FIXME: fold

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 net/bridge/netfilter/ebtables.c |   24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -170,8 +170,9 @@ unsigned int ebt_do_table (unsigned int 
 	private = table->private;
 	cb_base = COUNTER_BASE(private->counters, private->nentries,
 	   smp_processor_id());
-	if (private->chainstack)
-		cs = private->chainstack[smp_processor_id()];
+	if (private->chainstack_pcpu)
+		/* FIXME: use __get_cpu_ptr when available. */
+		cs = *per_cpu_ptr(private->chainstack_pcpu, smp_processor_id());
 	else
 		cs = NULL;
 	chaininfo = private->hook_entry[hook];
@@ -861,13 +861,14 @@ static int translate_table(char *name, s
 	if (udc_cnt) {
 		/* this will get free'd in do_replace()/ebt_register_table()
 		   if an error occurs */
-		newinfo->chainstack_pcpu = alloc_percpu(struct ebt_chainstack **);
+		newinfo->chainstack_pcpu =
+			alloc_percpu(struct ebt_chainstack *);
 		if (!newinfo->chainstack_pcpu)
 			return -ENOMEM;
 		for_each_possible_cpu(i) {
-			*per_cpu_ptr(newinfo->chainstack, i) =
+			*per_cpu_ptr(newinfo->chainstack_pcpu, i) =
 			  vmalloc(udc_cnt * sizeof(*(newinfo->chainstack_pcpu[0])));
-			if (!*per_cpu_ptr(newinfo->chainstack, i)) {
+			if (!*per_cpu_ptr(newinfo->chainstack_pcpu, i)) {
 				int j;
 				for_each_possible_cpu(j) {
 					if (j == i)
@@ -1145,7 +1146,7 @@ struct ebt_table *ebt_register_table(str
 		memset(newinfo->counters, 0, countersize);
 
 	/* fill in newinfo and parse the entries */
-	newinfo->chainstack = NULL;
+	newinfo->chainstack_pcpu = NULL;
 	for (i = 0; i < NF_BR_NUMHOOKS; i++) {
 		if ((repl->valid_hooks & (1 << i)) == 0)
 			newinfo->hook_entry[i] = NULL;
@@ -1189,10 +1190,10 @@ free_unlock:
 free_unlock:
 	mutex_unlock(&ebt_mutex);
 free_chainstack:
-	if (newinfo->chainstack) {
+	if (newinfo->chainstack_pcpu) {
 		for_each_possible_cpu(i)
 			vfree(*per_cpu_ptr(newinfo->chainstack_pcpu, i));
-		free_percpu(table->chainstack_pcpu);
+		free_percpu(newinfo->chainstack_pcpu);
 	}
 	vfree(newinfo->entries);
 free_newinfo:
@@ -1219,10 +1220,10 @@ void ebt_unregister_table(struct ebt_tab
 	if (table->private->nentries)
 		module_put(table->me);
 	vfree(table->private->entries);
-	if (table->private->chainstack) {
+	if (table->private->chainstack_pcpu) {
 		for_each_possible_cpu(i)
-			vfree(*per_cpu_ptr(newinfo->chainstack_pcpu, i));
-		free_percpu(table->chainstack_pcpu);
+			vfree(*per_cpu_ptr(table->private->chainstack_pcpu, i));
+		free_percpu(table->private->chainstack_pcpu);
 	}
 	vfree(table->private);
 	kfree(table);
