]> git.ipfire.org Git - people/arne_f/kernel.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 Jun 2016 17:15:31 +0000 (10:15 -0700)
commit 0188346f21e6546498c2a0f84888797ad4063fc5 upstream.

Always returned 0.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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 726f4dd63671322ad5599a28a463526eb6254747..445a2d59b341765017e0ed14df4553a3e27109ec 100644 (file)
@@ -425,7 +425,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 55fa1dcac63de199d629499c8f8802bdb1ede891..9cac96f16c3b8948446486a1e55c0c2367609ee6 100644 (file)
@@ -1301,7 +1301,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)
@@ -1310,9 +1310,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));
@@ -1333,7 +1332,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,
@@ -1412,16 +1410,11 @@ static int translate_compat_table(struct xt_table_info **pinfo,
        entry1 = newinfo->entries[raw_smp_processor_id()];
        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 6adc9249af58c6e9e51c26083b018611bcc18679..7727e40d6c9a6274ff4cb841b0938f5c9dd6b3ad 100644 (file)
@@ -1566,7 +1566,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)
@@ -1575,10 +1575,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));
@@ -1587,11 +1586,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;
@@ -1604,7 +1601,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
@@ -1720,16 +1716,12 @@ translate_compat_table(struct net *net,
        entry1 = newinfo->entries[raw_smp_processor_id()];
        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 1278b81fb058212eda1b3264840050f87ffa1f3d..8dc827113702d03fa1eaa37e299fde18722bb46f 100644 (file)
@@ -1578,7 +1578,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)
@@ -1586,10 +1586,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));
@@ -1598,11 +1597,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);
@@ -1614,7 +1611,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,
@@ -1729,17 +1725,12 @@ translate_compat_table(struct net *net,
        }
        entry1 = newinfo->entries[raw_smp_processor_id()];
        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 7632f46b7c6c3f171b0baf02a4da49c6d3f5304a..ae69e6e940bfd9c341cae3588b9ee8a9013b40c9 100644 (file)
@@ -545,8 +545,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;
@@ -568,7 +568,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);