]> err.no Git - linux-2.6/blobdiff - net/ipv4/netfilter/ipt_recent.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
[linux-2.6] / net / ipv4 / netfilter / ipt_recent.c
index d03e6a6eb767705564a72cefbb8177c2eac4e3ad..6d0c0f7364adbcac35fc4a332e11f6841e0430b3 100644 (file)
@@ -163,10 +163,9 @@ static void recent_table_flush(struct recent_table *t)
        struct recent_entry *e, *next;
        unsigned int i;
 
-       for (i = 0; i < ip_list_hash_size; i++) {
+       for (i = 0; i < ip_list_hash_size; i++)
                list_for_each_entry_safe(e, next, &t->iphash[i], list)
                        recent_entry_remove(t, e);
-       }
 }
 
 static bool
@@ -329,12 +328,10 @@ static void *recent_seq_start(struct seq_file *seq, loff_t *pos)
 
        spin_lock_bh(&recent_lock);
 
-       for (st->bucket = 0; st->bucket < ip_list_hash_size; st->bucket++) {
-               list_for_each_entry(e, &t->iphash[st->bucket], list) {
+       for (st->bucket = 0; st->bucket < ip_list_hash_size; st->bucket++)
+               list_for_each_entry(e, &t->iphash[st->bucket], list)
                        if (p-- == 0)
                                return e;
-               }
-       }
        return NULL;
 }
 
@@ -373,7 +370,7 @@ static int recent_seq_show(struct seq_file *seq, void *v)
        return 0;
 }
 
-static struct seq_operations recent_seq_ops = {
+static const struct seq_operations recent_seq_ops = {
        .start          = recent_seq_start,
        .next           = recent_seq_next,
        .stop           = recent_seq_stop,
@@ -390,12 +387,17 @@ static int recent_seq_open(struct inode *inode, struct file *file)
        st = kzalloc(sizeof(*st), GFP_KERNEL);
        if (st == NULL)
                return -ENOMEM;
+
        ret = seq_open(file, &recent_seq_ops);
-       if (ret)
+       if (ret) {
                kfree(st);
+               goto out;
+       }
+
        st->table    = pde->data;
        seq          = file->private_data;
        seq->private = st;
+out:
        return ret;
 }
 
@@ -463,7 +465,7 @@ static const struct file_operations recent_fops = {
 };
 #endif /* CONFIG_PROC_FS */
 
-static struct xt_match recent_match = {
+static struct xt_match recent_match __read_mostly = {
        .name           = "recent",
        .family         = AF_INET,
        .match          = ipt_recent_match,