netfilter: ipset: Fix sparse warnings "incorrect type in assignment"
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 21 Sep 2012 19:44:58 +0000 (21:44 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 21 Sep 2012 19:51:22 +0000 (21:51 +0200)
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
net/netfilter/ipset/ip_set_hash_ip.c
net/netfilter/ipset/ip_set_hash_ipport.c
net/netfilter/ipset/ip_set_hash_ipportip.c
net/netfilter/ipset/ip_set_hash_ipportnet.c
net/netfilter/ipset/ip_set_hash_net.c
net/netfilter/ipset/ip_set_hash_netiface.c
net/netfilter/ipset/ip_set_hash_netport.c

index a68dbd4f1e4e4404d25d6b71e321122fd4fae66a..42bccd58cbc6df6acf05c2e7dd8f5457ecb2ef56 100644 (file)
@@ -114,7 +114,7 @@ nla_put_failure:
 static inline void
 hash_ip4_data_next(struct ip_set_hash *h, const struct hash_ip4_elem *d)
 {
-       h->next.ip = ntohl(d->ip);
+       h->next.ip = d->ip;
 }
 
 static int
@@ -188,7 +188,7 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[],
        hosts = h->netmask == 32 ? 1 : 2 << (32 - h->netmask - 1);
 
        if (retried)
-               ip = h->next.ip;
+               ip = ntohl(h->next.ip);
        for (; !before(ip_to, ip); ip += hosts) {
                nip = htonl(ip);
                if (nip == 0)
index 92722bb82eea65cde13c77ce78be136fca2a8b94..e0ce0daefac1397cafe85df0e745d138ee12e758 100644 (file)
@@ -130,8 +130,8 @@ static inline void
 hash_ipport4_data_next(struct ip_set_hash *h,
                       const struct hash_ipport4_elem *d)
 {
-       h->next.ip = ntohl(d->ip);
-       h->next.port = ntohs(d->port);
+       h->next.ip = d->ip;
+       h->next.port = d->port;
 }
 
 static int
@@ -231,9 +231,10 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],
        }
 
        if (retried)
-               ip = h->next.ip;
+               ip = ntohl(h->next.ip);
        for (; !before(ip_to, ip); ip++) {
-               p = retried && ip == h->next.ip ? h->next.port : port;
+               p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
+                                                      : port;
                for (; p <= port_to; p++) {
                        data.ip = htonl(ip);
                        data.port = htons(p);
@@ -349,7 +350,7 @@ static inline void
 hash_ipport6_data_next(struct ip_set_hash *h,
                       const struct hash_ipport6_elem *d)
 {
-       h->next.port = ntohs(d->port);
+       h->next.port = d->port;
 }
 
 static int
@@ -431,7 +432,7 @@ hash_ipport6_uadt(struct ip_set *set, struct nlattr *tb[],
                swap(port, port_to);
 
        if (retried)
-               port = h->next.port;
+               port = ntohs(h->next.port);
        for (; port <= port_to; port++) {
                data.port = htons(port);
                ret = adtfn(set, &data, timeout, flags);
index 0637ce096def10e4faad6ef18003e263c8e8b77c..c864bf40e6beb8ad5d61da4ffb8de88ae9f3257c 100644 (file)
@@ -133,8 +133,8 @@ static inline void
 hash_ipportip4_data_next(struct ip_set_hash *h,
                         const struct hash_ipportip4_elem *d)
 {
-       h->next.ip = ntohl(d->ip);
-       h->next.port = ntohs(d->port);
+       h->next.ip = d->ip;
+       h->next.port = d->port;
 }
 
 static int
@@ -239,9 +239,10 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],
        }
 
        if (retried)
-               ip = h->next.ip;
+               ip = ntohl(h->next.ip);
        for (; !before(ip_to, ip); ip++) {
-               p = retried && ip == h->next.ip ? h->next.port : port;
+               p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
+                                                      : port;
                for (; p <= port_to; p++) {
                        data.ip = htonl(ip);
                        data.port = htons(p);
@@ -362,7 +363,7 @@ static inline void
 hash_ipportip6_data_next(struct ip_set_hash *h,
                         const struct hash_ipportip6_elem *d)
 {
-       h->next.port = ntohs(d->port);
+       h->next.port = d->port;
 }
 
 static int
@@ -449,7 +450,7 @@ hash_ipportip6_uadt(struct ip_set *set, struct nlattr *tb[],
                swap(port, port_to);
 
        if (retried)
-               port = h->next.port;
+               port = ntohs(h->next.port);
        for (; port <= port_to; port++) {
                data.port = htons(port);
                ret = adtfn(set, &data, timeout, flags);
index 1ce21ca976e17bb077f1e790677cc7af99f7c7aa..2c704bb3cff154c0f3ab49ffb7d5f3b71fb10fe3 100644 (file)
@@ -173,9 +173,9 @@ static inline void
 hash_ipportnet4_data_next(struct ip_set_hash *h,
                          const struct hash_ipportnet4_elem *d)
 {
-       h->next.ip = ntohl(d->ip);
-       h->next.port = ntohs(d->port);
-       h->next.ip2 = ntohl(d->ip2);
+       h->next.ip = d->ip;
+       h->next.port = d->port;
+       h->next.ip2 = d->ip2;
 }
 
 static int
@@ -314,14 +314,17 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
        }
 
        if (retried)
-               ip = h->next.ip;
+               ip = ntohl(h->next.ip);
        for (; !before(ip_to, ip); ip++) {
                data.ip = htonl(ip);
-               p = retried && ip == h->next.ip ? h->next.port : port;
+               p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
+                                                      : port;
                for (; p <= port_to; p++) {
                        data.port = htons(p);
-                       ip2 = retried && ip == h->next.ip && p == h->next.port
-                               ? h->next.ip2 : ip2_from;
+                       ip2 = retried
+                             && ip == ntohl(h->next.ip)
+                             && p == ntohs(h->next.port)
+                               ? ntohl(h->next.ip2) : ip2_from;
                        while (!after(ip2, ip2_to)) {
                                data.ip2 = htonl(ip2);
                                ip2_last = ip_set_range_to_cidr(ip2, ip2_to,
@@ -486,7 +489,7 @@ static inline void
 hash_ipportnet6_data_next(struct ip_set_hash *h,
                          const struct hash_ipportnet6_elem *d)
 {
-       h->next.port = ntohs(d->port);
+       h->next.port = d->port;
 }
 
 static int
@@ -598,7 +601,7 @@ hash_ipportnet6_uadt(struct ip_set *set, struct nlattr *tb[],
                swap(port, port_to);
 
        if (retried)
-               port = h->next.port;
+               port = ntohs(h->next.port);
        for (; port <= port_to; port++) {
                data.port = htons(port);
                ret = adtfn(set, &data, timeout, flags);
index c57a6a09906d7df3338f900d2b3b7321f487b103..d676093822b1b945591829e5ba707a1fdddfd987 100644 (file)
@@ -152,7 +152,7 @@ static inline void
 hash_net4_data_next(struct ip_set_hash *h,
                    const struct hash_net4_elem *d)
 {
-       h->next.ip = ntohl(d->ip);
+       h->next.ip = d->ip;
 }
 
 static int
@@ -235,7 +235,7 @@ hash_net4_uadt(struct ip_set *set, struct nlattr *tb[],
                        return -IPSET_ERR_HASH_RANGE;
        }
        if (retried)
-               ip = h->next.ip;
+               ip = ntohl(h->next.ip);
        while (!after(ip, ip_to)) {
                data.ip = htonl(ip);
                last = ip_set_range_to_cidr(ip, ip_to, &data.cidr);
index d5d3607ae7bcf5e9704bd189217115cf048aee4b..632693f0beeb7fb60cf467fcd5cf383ae33c6c40 100644 (file)
@@ -277,7 +277,7 @@ static inline void
 hash_netiface4_data_next(struct ip_set_hash *h,
                         const struct hash_netiface4_elem *d)
 {
-       h->next.ip = ntohl(d->ip);
+       h->next.ip = d->ip;
 }
 
 static int
@@ -409,7 +409,7 @@ hash_netiface4_uadt(struct ip_set *set, struct nlattr *tb[],
        }
 
        if (retried)
-               ip = h->next.ip;
+               ip = ntohl(h->next.ip);
        while (!after(ip, ip_to)) {
                data.ip = htonl(ip);
                last = ip_set_range_to_cidr(ip, ip_to, &data.cidr);
index fc3143a2d41bbdd07747ede2339ecf8407911cc0..3ec27fccddd7c850ab7b8a361ed51966dd8c3342 100644 (file)
@@ -171,8 +171,8 @@ static inline void
 hash_netport4_data_next(struct ip_set_hash *h,
                        const struct hash_netport4_elem *d)
 {
-       h->next.ip = ntohl(d->ip);
-       h->next.port = ntohs(d->port);
+       h->next.ip = d->ip;
+       h->next.port = d->port;
 }
 
 static int
@@ -289,12 +289,13 @@ hash_netport4_uadt(struct ip_set *set, struct nlattr *tb[],
        }
 
        if (retried)
-               ip = h->next.ip;
+               ip = ntohl(h->next.ip);
        while (!after(ip, ip_to)) {
                data.ip = htonl(ip);
                last = ip_set_range_to_cidr(ip, ip_to, &cidr);
                data.cidr = cidr - 1;
-               p = retried && ip == h->next.ip ? h->next.port : port;
+               p = retried && ip == ntohl(h->next.ip) ? ntohs(h->next.port)
+                                                      : port;
                for (; p <= port_to; p++) {
                        data.port = htons(p);
                        ret = adtfn(set, &data, timeout, flags);
@@ -450,7 +451,7 @@ static inline void
 hash_netport6_data_next(struct ip_set_hash *h,
                        const struct hash_netport6_elem *d)
 {
-       h->next.port = ntohs(d->port);
+       h->next.port = d->port;
 }
 
 static int
@@ -554,7 +555,7 @@ hash_netport6_uadt(struct ip_set *set, struct nlattr *tb[],
                swap(port, port_to);
 
        if (retried)
-               port = h->next.port;
+               port = ntohs(h->next.port);
        for (; port <= port_to; port++) {
                data.port = htons(port);
                ret = adtfn(set, &data, timeout, flags);