]> granicus.if.org Git - ipset/commitdiff
Sparse warnings "incorrect type in assignment" fixed
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 4 May 2012 19:46:48 +0000 (21:46 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 4 May 2012 19:46:48 +0000 (21:46 +0200)
kernel/net/netfilter/ipset/ip_set_hash_ip.c
kernel/net/netfilter/ipset/ip_set_hash_ipport.c
kernel/net/netfilter/ipset/ip_set_hash_ipportip.c
kernel/net/netfilter/ipset/ip_set_hash_ipportnet.c
kernel/net/netfilter/ipset/ip_set_hash_net.c
kernel/net/netfilter/ipset/ip_set_hash_netiface.c
kernel/net/netfilter/ipset/ip_set_hash_netport.c

index 5139dea6019e44ba24ee01d9c4f65beb3eddfe61..3d99299bd4a8ba75c3649e6843161ffb39a261d1 100644 (file)
@@ -112,7 +112,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
@@ -186,7 +186,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 9c27e249c1713bb14d9d03c730bd2a5a125c6177..106f494d85962cf7be0ae7c2c531e41e8ba672f9 100644 (file)
@@ -129,8 +129,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
@@ -230,9 +230,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);
@@ -346,7 +347,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
@@ -428,7 +429,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 9134057c07284cf41b1e2d119415e8c043a0fc9a..c8e445383e0ac01dd83d32410301e1d41ef32abe 100644 (file)
@@ -132,8 +132,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
@@ -238,9 +238,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);
@@ -359,7 +360,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
@@ -446,7 +447,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 5d05e69698626570ca8247732d4bb8f8af632674..782c992cf3c212238c72702a87a6c9fa7c74574a 100644 (file)
@@ -172,9 +172,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
@@ -313,14 +313,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,
@@ -483,7 +486,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
@@ -595,7 +598,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 7c3d945517cfa55c62faeccb24d6bce29c958faa..9f61063fe23d33add27a6c1d7184730570b1f352 100644 (file)
@@ -151,7 +151,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
@@ -234,7 +234,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 f24037ff432201015e81731f61133d45079128d6..f51f919ed08dfc0dba0fe687abdf70903bbc0590 100644 (file)
@@ -299,7 +299,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
@@ -431,7 +431,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 ce2e77100b64ecb521db1cf45c0babd4902a374f..d7df21c85ef29ee22c215266251ed73cf38acc20 100644 (file)
@@ -170,8 +170,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
@@ -288,12 +288,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);
@@ -447,7 +448,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
@@ -551,7 +552,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);