aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2006-04-11 01:52:50 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-11 09:18:31 -0400
commit6f912042256c12b0927438122594f5379b364f5d (patch)
treec11949814057b356d5896e7f025ec15132dbff78 /net/bridge
parentdd7ba3b8b15f9c65366986d723ae83254d8d78b7 (diff)
[PATCH] for_each_possible_cpu: network codes
for_each_cpu() actually iterates across all possible CPUs. We've had mistakes in the past where people were using for_each_cpu() where they should have been iterating across only online or present CPUs. This is inefficient and possibly buggy. We're renaming for_each_cpu() to for_each_possible_cpu() to avoid this in the future. This patch replaces for_each_cpu with for_each_possible_cpu under /net Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: "David S. Miller" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/netfilter/ebtables.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 01eae97c53d9..66bd93252c4e 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -829,7 +829,7 @@ static int translate_table(struct ebt_replace *repl,
829 * sizeof(struct ebt_chainstack)); 829 * sizeof(struct ebt_chainstack));
830 if (!newinfo->chainstack) 830 if (!newinfo->chainstack)
831 return -ENOMEM; 831 return -ENOMEM;
832 for_each_cpu(i) { 832 for_each_possible_cpu(i) {
833 newinfo->chainstack[i] = 833 newinfo->chainstack[i] =
834 vmalloc(udc_cnt * sizeof(struct ebt_chainstack)); 834 vmalloc(udc_cnt * sizeof(struct ebt_chainstack));
835 if (!newinfo->chainstack[i]) { 835 if (!newinfo->chainstack[i]) {
@@ -901,7 +901,7 @@ static void get_counters(struct ebt_counter *oldcounters,
901 sizeof(struct ebt_counter) * nentries); 901 sizeof(struct ebt_counter) * nentries);
902 902
903 /* add other counters to those of cpu 0 */ 903 /* add other counters to those of cpu 0 */
904 for_each_cpu(cpu) { 904 for_each_possible_cpu(cpu) {
905 if (cpu == 0) 905 if (cpu == 0)
906 continue; 906 continue;
907 counter_base = COUNTER_BASE(oldcounters, nentries, cpu); 907 counter_base = COUNTER_BASE(oldcounters, nentries, cpu);
@@ -1036,7 +1036,7 @@ static int do_replace(void __user *user, unsigned int len)
1036 1036
1037 vfree(table->entries); 1037 vfree(table->entries);
1038 if (table->chainstack) { 1038 if (table->chainstack) {
1039 for_each_cpu(i) 1039 for_each_possible_cpu(i)
1040 vfree(table->chainstack[i]); 1040 vfree(table->chainstack[i]);
1041 vfree(table->chainstack); 1041 vfree(table->chainstack);
1042 } 1042 }
@@ -1054,7 +1054,7 @@ free_counterstmp:
1054 vfree(counterstmp); 1054 vfree(counterstmp);
1055 /* can be initialized in translate_table() */ 1055 /* can be initialized in translate_table() */
1056 if (newinfo->chainstack) { 1056 if (newinfo->chainstack) {
1057 for_each_cpu(i) 1057 for_each_possible_cpu(i)
1058 vfree(newinfo->chainstack[i]); 1058 vfree(newinfo->chainstack[i]);
1059 vfree(newinfo->chainstack); 1059 vfree(newinfo->chainstack);
1060 } 1060 }
@@ -1201,7 +1201,7 @@ free_unlock:
1201 mutex_unlock(&ebt_mutex); 1201 mutex_unlock(&ebt_mutex);
1202free_chainstack: 1202free_chainstack:
1203 if (newinfo->chainstack) { 1203 if (newinfo->chainstack) {
1204 for_each_cpu(i) 1204 for_each_possible_cpu(i)
1205 vfree(newinfo->chainstack[i]); 1205 vfree(newinfo->chainstack[i]);
1206 vfree(newinfo->chainstack); 1206 vfree(newinfo->chainstack);
1207 } 1207 }
@@ -1224,7 +1224,7 @@ void ebt_unregister_table(struct ebt_table *table)
1224 mutex_unlock(&ebt_mutex); 1224 mutex_unlock(&ebt_mutex);
1225 vfree(table->private->entries); 1225 vfree(table->private->entries);
1226 if (table->private->chainstack) { 1226 if (table->private->chainstack) {
1227 for_each_cpu(i) 1227 for_each_possible_cpu(i)
1228 vfree(table->private->chainstack[i]); 1228 vfree(table->private->chainstack[i]);
1229 vfree(table->private->chainstack); 1229 vfree(table->private->chainstack);
1230 } 1230 }