]> git.karo-electronics.de Git - linux-beck.git/commitdiff
netfilter: x_tables: xt_compat_match_from_user doesn't need a retval
authorFlorian Westphal <fw@strlen.de>
Fri, 1 Apr 2016 12:17:33 +0000 (14:17 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 13 Apr 2016 22:30:40 +0000 (00:30 +0200)
Always returned 0.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/linux/netfilter/x_tables.h
net/ipv4/netfilter/arp_tables.c
net/ipv4/netfilter/ip_tables.c
net/ipv6/netfilter/ip6_tables.c
net/netfilter/x_tables.c

index 30cfb1e943fb6309c216f1bee5c39e71000001a4..e2da9b90f1b8ab22038ff10547d3b32786881211 100644 (file)
@@ -484,7 +484,7 @@ void xt_compat_init_offsets(u_int8_t af, unsigned int number);
 int xt_compat_calc_jump(u_int8_t af, unsigned int offset);
 
 int xt_compat_match_offset(const struct xt_match *match);
-int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
+void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
                              unsigned int *size);
 int xt_compat_match_to_user(const struct xt_entry_match *m,
                            void __user **dstptr, unsigned int *size);
index 1d1386dc159bcf44b8b5be1a893250d82a95d294..be514c676fad5664df87f546790887d1f65660b2 100644 (file)
@@ -1310,7 +1310,7 @@ out:
        return ret;
 }
 
-static int
+static void
 compat_copy_entry_from_user(struct compat_arpt_entry *e, void **dstptr,
                            unsigned int *size,
                            struct xt_table_info *newinfo, unsigned char *base)
@@ -1319,9 +1319,8 @@ compat_copy_entry_from_user(struct compat_arpt_entry *e, void **dstptr,
        struct xt_target *target;
        struct arpt_entry *de;
        unsigned int origsize;
-       int ret, h;
+       int h;
 
-       ret = 0;
        origsize = *size;
        de = (struct arpt_entry *)*dstptr;
        memcpy(de, e, sizeof(struct arpt_entry));
@@ -1342,7 +1341,6 @@ compat_copy_entry_from_user(struct compat_arpt_entry *e, void **dstptr,
                if ((unsigned char *)de - base < newinfo->underflow[h])
                        newinfo->underflow[h] -= origsize - *size;
        }
-       return ret;
 }
 
 static int translate_compat_table(struct xt_table_info **pinfo,
@@ -1421,16 +1419,11 @@ static int translate_compat_table(struct xt_table_info **pinfo,
        entry1 = newinfo->entries;
        pos = entry1;
        size = compatr->size;
-       xt_entry_foreach(iter0, entry0, compatr->size) {
-               ret = compat_copy_entry_from_user(iter0, &pos, &size,
-                                                 newinfo, entry1);
-               if (ret != 0)
-                       break;
-       }
+       xt_entry_foreach(iter0, entry0, compatr->size)
+               compat_copy_entry_from_user(iter0, &pos, &size,
+                                           newinfo, entry1);
        xt_compat_flush_offsets(NFPROTO_ARP);
        xt_compat_unlock(NFPROTO_ARP);
-       if (ret)
-               goto free_newinfo;
 
        ret = -ELOOP;
        if (!mark_source_chains(newinfo, compatr->valid_hooks, entry1))
index d70418604503bbf8b9eb67bc5faca1adad6ce481..5c20eef980c10b201e306438f58b137ca9a36643 100644 (file)
@@ -1568,7 +1568,7 @@ release_matches:
        return ret;
 }
 
-static int
+static void
 compat_copy_entry_from_user(struct compat_ipt_entry *e, void **dstptr,
                            unsigned int *size,
                            struct xt_table_info *newinfo, unsigned char *base)
@@ -1577,10 +1577,9 @@ compat_copy_entry_from_user(struct compat_ipt_entry *e, void **dstptr,
        struct xt_target *target;
        struct ipt_entry *de;
        unsigned int origsize;
-       int ret, h;
+       int h;
        struct xt_entry_match *ematch;
 
-       ret = 0;
        origsize = *size;
        de = (struct ipt_entry *)*dstptr;
        memcpy(de, e, sizeof(struct ipt_entry));
@@ -1589,11 +1588,9 @@ compat_copy_entry_from_user(struct compat_ipt_entry *e, void **dstptr,
        *dstptr += sizeof(struct ipt_entry);
        *size += sizeof(struct ipt_entry) - sizeof(struct compat_ipt_entry);
 
-       xt_ematch_foreach(ematch, e) {
-               ret = xt_compat_match_from_user(ematch, dstptr, size);
-               if (ret != 0)
-                       return ret;
-       }
+       xt_ematch_foreach(ematch, e)
+               xt_compat_match_from_user(ematch, dstptr, size);
+
        de->target_offset = e->target_offset - (origsize - *size);
        t = compat_ipt_get_target(e);
        target = t->u.kernel.target;
@@ -1606,7 +1603,6 @@ compat_copy_entry_from_user(struct compat_ipt_entry *e, void **dstptr,
                if ((unsigned char *)de - base < newinfo->underflow[h])
                        newinfo->underflow[h] -= origsize - *size;
        }
-       return ret;
 }
 
 static int
@@ -1729,16 +1725,12 @@ translate_compat_table(struct net *net,
        entry1 = newinfo->entries;
        pos = entry1;
        size = compatr->size;
-       xt_entry_foreach(iter0, entry0, compatr->size) {
-               ret = compat_copy_entry_from_user(iter0, &pos, &size,
-                                                 newinfo, entry1);
-               if (ret != 0)
-                       break;
-       }
+       xt_entry_foreach(iter0, entry0, compatr->size)
+               compat_copy_entry_from_user(iter0, &pos, &size,
+                                           newinfo, entry1);
+
        xt_compat_flush_offsets(AF_INET);
        xt_compat_unlock(AF_INET);
-       if (ret)
-               goto free_newinfo;
 
        ret = -ELOOP;
        if (!mark_source_chains(newinfo, compatr->valid_hooks, entry1))
index 8d082c5577711a267f0efd6ad6234ec36dfeb0ca..620d54c1c1194182530e564495eab3bac97b1a54 100644 (file)
@@ -1580,7 +1580,7 @@ release_matches:
        return ret;
 }
 
-static int
+static void
 compat_copy_entry_from_user(struct compat_ip6t_entry *e, void **dstptr,
                            unsigned int *size,
                            struct xt_table_info *newinfo, unsigned char *base)
@@ -1588,10 +1588,9 @@ compat_copy_entry_from_user(struct compat_ip6t_entry *e, void **dstptr,
        struct xt_entry_target *t;
        struct ip6t_entry *de;
        unsigned int origsize;
-       int ret, h;
+       int h;
        struct xt_entry_match *ematch;
 
-       ret = 0;
        origsize = *size;
        de = (struct ip6t_entry *)*dstptr;
        memcpy(de, e, sizeof(struct ip6t_entry));
@@ -1600,11 +1599,9 @@ compat_copy_entry_from_user(struct compat_ip6t_entry *e, void **dstptr,
        *dstptr += sizeof(struct ip6t_entry);
        *size += sizeof(struct ip6t_entry) - sizeof(struct compat_ip6t_entry);
 
-       xt_ematch_foreach(ematch, e) {
-               ret = xt_compat_match_from_user(ematch, dstptr, size);
-               if (ret != 0)
-                       return ret;
-       }
+       xt_ematch_foreach(ematch, e)
+               xt_compat_match_from_user(ematch, dstptr, size);
+
        de->target_offset = e->target_offset - (origsize - *size);
        t = compat_ip6t_get_target(e);
        xt_compat_target_from_user(t, dstptr, size);
@@ -1616,7 +1613,6 @@ compat_copy_entry_from_user(struct compat_ip6t_entry *e, void **dstptr,
                if ((unsigned char *)de - base < newinfo->underflow[h])
                        newinfo->underflow[h] -= origsize - *size;
        }
-       return ret;
 }
 
 static int compat_check_entry(struct ip6t_entry *e, struct net *net,
@@ -1737,17 +1733,12 @@ translate_compat_table(struct net *net,
        }
        entry1 = newinfo->entries;
        pos = entry1;
-       size = compatr->size;
-       xt_entry_foreach(iter0, entry0, compatr->size) {
-               ret = compat_copy_entry_from_user(iter0, &pos, &size,
-                                                 newinfo, entry1);
-               if (ret != 0)
-                       break;
-       }
+       xt_entry_foreach(iter0, entry0, compatr->size)
+               compat_copy_entry_from_user(iter0, &pos, &size,
+                                           newinfo, entry1);
+
        xt_compat_flush_offsets(AF_INET6);
        xt_compat_unlock(AF_INET6);
-       if (ret)
-               goto free_newinfo;
 
        ret = -ELOOP;
        if (!mark_source_chains(newinfo, compatr->valid_hooks, entry1))
index f9aa9715c32ef196ac97a2ef7ddbc423ee0ecb72..7e7173b68344f36f3e32f985ed625a12a808c202 100644 (file)
@@ -526,8 +526,8 @@ int xt_compat_match_offset(const struct xt_match *match)
 }
 EXPORT_SYMBOL_GPL(xt_compat_match_offset);
 
-int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
-                             unsigned int *size)
+void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
+                              unsigned int *size)
 {
        const struct xt_match *match = m->u.kernel.match;
        struct compat_xt_entry_match *cm = (struct compat_xt_entry_match *)m;
@@ -549,7 +549,6 @@ int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
 
        *size += off;
        *dstptr += msize;
-       return 0;
 }
 EXPORT_SYMBOL_GPL(xt_compat_match_from_user);