aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2007-12-05 02:24:56 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:55:54 -0500
commit259d4e41f3ec25f22169daece42729f597b89f9a (patch)
tree8d3d335b3f16834e6374a125f449db383306961d /net/ipv6
parentd3c5ee6d545b5372fd525ebe16988a5b6efeceb0 (diff)
[NETFILTER]: x_tables: struct xt_table_info diet
Instead of using a big array of NR_CPUS entries, we can compute the size needed at runtime, using nr_cpu_ids This should save some ram (especially on David's machines where NR_CPUS=4096 : 32 KB can be saved per table, and 64KB for dynamically allocated ones (because of slab/slub alignements) ) In particular, the 'bootstrap' tables are not any more static (in data section) but on stack as their size is now very small. This also should reduce the size used on stack in compat functions (get_info() declares an automatic variable, that could be bigger than kernel stack size for big NR_CPUS) Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/netfilter/ip6_tables.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index e1e87eff4686..e60c1b4b1ec8 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -1042,8 +1042,7 @@ do_replace(void __user *user, unsigned int len)
1042 return -EFAULT; 1042 return -EFAULT;
1043 1043
1044 /* overflow check */ 1044 /* overflow check */
1045 if (tmp.size >= (INT_MAX - sizeof(struct xt_table_info)) / NR_CPUS - 1045 if (tmp.size >= INT_MAX / num_possible_cpus())
1046 SMP_CACHE_BYTES)
1047 return -ENOMEM; 1046 return -ENOMEM;
1048 if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) 1047 if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters))
1049 return -ENOMEM; 1048 return -ENOMEM;
@@ -1339,7 +1338,7 @@ int ip6t_register_table(struct xt_table *table,
1339{ 1338{
1340 int ret; 1339 int ret;
1341 struct xt_table_info *newinfo; 1340 struct xt_table_info *newinfo;
1342 static struct xt_table_info bootstrap 1341 struct xt_table_info bootstrap
1343 = { 0, 0, 0, { 0 }, { 0 }, { } }; 1342 = { 0, 0, 0, { 0 }, { 0 }, { } };
1344 void *loc_cpu_entry; 1343 void *loc_cpu_entry;
1345 1344