diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2011-01-20 10:20:14 +0100 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2011-01-20 10:20:14 +0100 |
commit | c2d28607e25b8884ffb893ab4bc6cbb3b1c5a386 (patch) | |
tree | 21ee322d19a38feb0df082566ca55baa198a95e2 /kernel | |
parent | 7cd45445d55b14b7aca69a81b7815a98afc51784 (diff) | |
download | ipset-c2d28607e25b8884ffb893ab4bc6cbb3b1c5a386.tar.gz |
Fix the placement style of boolean operators at continued lines
Fix "&&" and "||" continuation style (Patrick McHardy's review)
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/include/linux/netfilter/ipset/ip_set_ahash.h | 4 | ||||
-rw-r--r-- | kernel/include/linux/netfilter/ipset/ip_set_timeout.h | 20 | ||||
-rw-r--r-- | kernel/ip_set_bitmap_ip.c | 18 | ||||
-rw-r--r-- | kernel/ip_set_bitmap_ipmac.c | 30 | ||||
-rw-r--r-- | kernel/ip_set_bitmap_port.c | 10 | ||||
-rw-r--r-- | kernel/ip_set_core.c | 154 | ||||
-rw-r--r-- | kernel/ip_set_hash_ip.c | 12 | ||||
-rw-r--r-- | kernel/ip_set_hash_ipport.c | 30 | ||||
-rw-r--r-- | kernel/ip_set_hash_ipportip.c | 34 | ||||
-rw-r--r-- | kernel/ip_set_hash_ipportnet.c | 38 | ||||
-rw-r--r-- | kernel/ip_set_hash_net.c | 8 | ||||
-rw-r--r-- | kernel/ip_set_hash_netport.c | 32 | ||||
-rw-r--r-- | kernel/ip_set_list_set.c | 40 | ||||
-rw-r--r-- | kernel/xt_set.c | 8 |
14 files changed, 219 insertions, 219 deletions
diff --git a/kernel/include/linux/netfilter/ipset/ip_set_ahash.h b/kernel/include/linux/netfilter/ipset/ip_set_ahash.h index 2975041..621e119 100644 --- a/kernel/include/linux/netfilter/ipset/ip_set_ahash.h +++ b/kernel/include/linux/netfilter/ipset/ip_set_ahash.h @@ -807,8 +807,8 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout) ret = -IPSET_ERR_EXIST; goto out; } - } else if (j == AHASH_MAX_SIZE + 1 - && type_pf_data_expired(data)) + } else if (j == AHASH_MAX_SIZE + 1 && + type_pf_data_expired(data)) j = i; } if (j != AHASH_MAX_SIZE + 1) { diff --git a/kernel/include/linux/netfilter/ipset/ip_set_timeout.h b/kernel/include/linux/netfilter/ipset/ip_set_timeout.h index 7383716..9f30c5f 100644 --- a/kernel/include/linux/netfilter/ipset/ip_set_timeout.h +++ b/kernel/include/linux/netfilter/ipset/ip_set_timeout.h @@ -43,17 +43,17 @@ ip_set_timeout_uget(struct nlattr *tb) static inline bool ip_set_timeout_test(unsigned long timeout) { - return timeout != IPSET_ELEM_UNSET - && (timeout == IPSET_ELEM_PERMANENT - || time_after(timeout, jiffies)); + return timeout != IPSET_ELEM_UNSET && + (timeout == IPSET_ELEM_PERMANENT || + time_after(timeout, jiffies)); } static inline bool ip_set_timeout_expired(unsigned long timeout) { - return timeout != IPSET_ELEM_UNSET - && timeout != IPSET_ELEM_PERMANENT - && time_before(timeout, jiffies); + return timeout != IPSET_ELEM_UNSET && + timeout != IPSET_ELEM_PERMANENT && + time_before(timeout, jiffies); } static inline unsigned long @@ -88,15 +88,15 @@ ip_set_timeout_get(unsigned long timeout) static inline bool ip_set_timeout_test(unsigned long timeout) { - return timeout == IPSET_ELEM_PERMANENT - || time_after(timeout, jiffies); + return timeout == IPSET_ELEM_PERMANENT || + time_after(timeout, jiffies); } static inline bool ip_set_timeout_expired(unsigned long timeout) { - return timeout != IPSET_ELEM_PERMANENT - && time_before(timeout, jiffies); + return timeout != IPSET_ELEM_PERMANENT && + time_before(timeout, jiffies); } static inline unsigned long diff --git a/kernel/ip_set_bitmap_ip.c b/kernel/ip_set_bitmap_ip.c index 1a8eed0..b653036 100644 --- a/kernel/ip_set_bitmap_ip.c +++ b/kernel/ip_set_bitmap_ip.c @@ -264,9 +264,9 @@ bitmap_ip_same_set(const struct ip_set *a, const struct ip_set *b) const struct bitmap_ip *x = a->data; const struct bitmap_ip *y = b->data; - return x->first_ip == y->first_ip - && x->last_ip == y->last_ip - && x->netmask == y->netmask; + return x->first_ip == y->first_ip && + x->last_ip == y->last_ip && + x->netmask == y->netmask; } static const struct ip_set_type_variant bitmap_ip = { @@ -511,10 +511,10 @@ bitmap_ip_timeout_same_set(const struct ip_set *a, const struct ip_set *b) const struct bitmap_ip_timeout *x = a->data; const struct bitmap_ip_timeout *y = b->data; - return x->first_ip == y->first_ip - && x->last_ip == y->last_ip - && x->netmask == y->netmask - && x->timeout == y->timeout; + return x->first_ip == y->first_ip && + x->last_ip == y->last_ip && + x->netmask == y->netmask && + x->timeout == y->timeout; } static const struct ip_set_type_variant bitmap_ip_timeout = { @@ -647,8 +647,8 @@ bitmap_ip_create(struct ip_set *set, struct nlattr *head, int len, mask = range_to_mask(first_ip, last_ip, &mask_bits); - if ((!mask && (first_ip || last_ip != 0xFFFFFFFF)) - || netmask <= mask_bits) + if ((!mask && (first_ip || last_ip != 0xFFFFFFFF)) || + netmask <= mask_bits) return -IPSET_ERR_BITMAP_RANGE; pr_debug("mask_bits %u, netmask %u", mask_bits, netmask); diff --git a/kernel/ip_set_bitmap_ipmac.c b/kernel/ip_set_bitmap_ipmac.c index d5a2e0f..c451b59 100644 --- a/kernel/ip_set_bitmap_ipmac.c +++ b/kernel/ip_set_bitmap_ipmac.c @@ -95,9 +95,9 @@ bitmap_expired(const struct bitmap_ipmac *map, u32 id) static inline int bitmap_ipmac_exist(const struct ipmac_telem *elem) { - return elem->match == MAC_UNSET - || (elem->match == MAC_FILLED - && !ip_set_timeout_expired(elem->timeout)); + return elem->match == MAC_UNSET || + (elem->match == MAC_FILLED && + !ip_set_timeout_expired(elem->timeout)); } /* Base variant */ @@ -114,8 +114,8 @@ bitmap_ipmac_test(struct ip_set *set, void *value, u32 timeout) /* Trigger kernel to fill out the ethernet address */ return -EAGAIN; case MAC_FILLED: - return data->ether == NULL - || compare_ether_addr(data->ether, elem->ether) == 0; + return data->ether == NULL || + compare_ether_addr(data->ether, elem->ether) == 0; } return 0; } @@ -223,9 +223,9 @@ bitmap_ipmac_ttest(struct ip_set *set, void *value, u32 timeout) /* Trigger kernel to fill out the ethernet address */ return -EAGAIN; case MAC_FILLED: - return (data->ether == NULL - || compare_ether_addr(data->ether, elem->ether) == 0) - && !bitmap_expired(map, data->id); + return (data->ether == NULL || + compare_ether_addr(data->ether, elem->ether) == 0) && + !bitmap_expired(map, data->id); } return 0; } @@ -348,8 +348,8 @@ bitmap_ipmac_kadt(struct ip_set *set, const struct sk_buff *skb, return -IPSET_ERR_BITMAP_RANGE; /* Backward compatibility: we don't check the second flag */ - if (skb_mac_header(skb) < skb->head - || (skb_mac_header(skb) + ETH_HLEN) > skb->data) + if (skb_mac_header(skb) < skb->head || + (skb_mac_header(skb) + ETH_HLEN) > skb->data) return -EINVAL; data.id -= map->first_ip; @@ -464,9 +464,9 @@ bitmap_ipmac_same_set(const struct ip_set *a, const struct ip_set *b) const struct bitmap_ipmac *x = a->data; const struct bitmap_ipmac *y = b->data; - return x->first_ip == y->first_ip - && x->last_ip == y->last_ip - && x->timeout == y->timeout; + return x->first_ip == y->first_ip && + x->last_ip == y->last_ip && + x->timeout == y->timeout; } const struct ip_set_type_variant bitmap_ipmac = { @@ -512,8 +512,8 @@ bitmap_ipmac_gc(unsigned long ul_set) read_lock_bh(&set->lock); for (id = 0; id <= last; id++) { elem = bitmap_ipmac_elem(map, id); - if (elem->match == MAC_FILLED - && ip_set_timeout_expired(elem->timeout)) + if (elem->match == MAC_FILLED && + ip_set_timeout_expired(elem->timeout)) elem->match = MAC_EMPTY; } read_unlock_bh(&set->lock); diff --git a/kernel/ip_set_bitmap_port.c b/kernel/ip_set_bitmap_port.c index bcffe0c..3d5e6e3 100644 --- a/kernel/ip_set_bitmap_port.c +++ b/kernel/ip_set_bitmap_port.c @@ -246,8 +246,8 @@ bitmap_port_same_set(const struct ip_set *a, const struct ip_set *b) const struct bitmap_port *x = a->data; const struct bitmap_port *y = b->data; - return x->first_port == y->first_port - && x->last_port == y->last_port; + return x->first_port == y->first_port && + x->last_port == y->last_port; } const struct ip_set_type_variant bitmap_port = { @@ -483,9 +483,9 @@ bitmap_port_timeout_same_set(const struct ip_set *a, const struct ip_set *b) const struct bitmap_port_timeout *x = a->data; const struct bitmap_port_timeout *y = b->data; - return x->first_port == y->first_port - && x->last_port == y->last_port - && x->timeout == y->timeout; + return x->first_port == y->first_port && + x->last_port == y->last_port && + x->timeout == y->timeout; } const struct ip_set_type_variant bitmap_port_timeout = { diff --git a/kernel/ip_set_core.c b/kernel/ip_set_core.c index 4634fd6..1a9f72d 100644 --- a/kernel/ip_set_core.c +++ b/kernel/ip_set_core.c @@ -67,9 +67,9 @@ find_set_type(const char *name, u8 family, u8 revision) struct ip_set_type *type; list_for_each_entry_rcu(type, &ip_set_type_list, list) - if (STREQ(type->name, name) - && (type->family == family || type->family == AF_UNSPEC) - && type->revision == revision) + if (STREQ(type->name, name) && + (type->family == family || type->family == AF_UNSPEC) && + type->revision == revision) return type; return NULL; } @@ -104,8 +104,8 @@ find_set_type_minmax(const char *name, u8 family, u8 *min, u8 *max) *min = *max = 0; rcu_read_lock(); list_for_each_entry_rcu(type, &ip_set_type_list, list) - if (STREQ(type->name, name) - && (type->family == family || type->family == AF_UNSPEC)) { + if (STREQ(type->name, name) && + (type->family == family || type->family == AF_UNSPEC)) { ret = true; if (type->revision < *min) *min = type->revision; @@ -215,8 +215,8 @@ ip_set_test(ip_set_id_t index, const struct sk_buff *skb, BUG_ON(set == NULL || atomic_read(&set->ref) == 0); pr_debug("set %s, index %u", set->name, index); - if (dim < set->type->dimension - || !(family == set->family || set->family == AF_UNSPEC)) + if (dim < set->type->dimension || + !(family == set->family || set->family == AF_UNSPEC)) return 0; read_lock_bh(&set->lock); @@ -247,8 +247,8 @@ ip_set_add(ip_set_id_t index, const struct sk_buff *skb, BUG_ON(set == NULL || atomic_read(&set->ref) == 0); pr_debug("set %s, index %u", set->name, index); - if (dim < set->type->dimension - || !(family == set->family || set->family == AF_UNSPEC)) + if (dim < set->type->dimension || + !(family == set->family || set->family == AF_UNSPEC)) return 0; write_lock_bh(&set->lock); @@ -269,8 +269,8 @@ ip_set_del(ip_set_id_t index, const struct sk_buff *skb, BUG_ON(set == NULL || atomic_read(&set->ref) == 0); pr_debug("set %s, index %u", set->name, index); - if (dim < set->type->dimension - || !(family == set->family || set->family == AF_UNSPEC)) + if (dim < set->type->dimension || + !(family == set->family || set->family == AF_UNSPEC)) return 0; write_lock_bh(&set->lock); @@ -420,8 +420,8 @@ EXPORT_SYMBOL_GPL(ip_set_nfnl_put); static inline bool protocol_failed(const struct nlattr * const tb[]) { - return !tb[IPSET_ATTR_PROTOCOL] - || nla_get_u8(tb[IPSET_ATTR_PROTOCOL]) != IPSET_PROTOCOL; + return !tb[IPSET_ATTR_PROTOCOL] || + nla_get_u8(tb[IPSET_ATTR_PROTOCOL]) != IPSET_PROTOCOL; } static inline u32 @@ -532,13 +532,13 @@ ip_set_create(struct sock *ctnl, struct sk_buff *skb, u32 flags = flag_exist(nlh); int ret = 0, len; - if (unlikely(protocol_failed(attr) - || attr[IPSET_ATTR_SETNAME] == NULL - || attr[IPSET_ATTR_TYPENAME] == NULL - || attr[IPSET_ATTR_REVISION] == NULL - || attr[IPSET_ATTR_FAMILY] == NULL - || (attr[IPSET_ATTR_DATA] != NULL - && !flag_nested(attr[IPSET_ATTR_DATA])))) + if (unlikely(protocol_failed(attr) || + attr[IPSET_ATTR_SETNAME] == NULL || + attr[IPSET_ATTR_TYPENAME] == NULL || + attr[IPSET_ATTR_REVISION] == NULL || + attr[IPSET_ATTR_FAMILY] == NULL || + (attr[IPSET_ATTR_DATA] != NULL && + !flag_nested(attr[IPSET_ATTR_DATA])))) return -IPSET_ERR_PROTOCOL; name = nla_data(attr[IPSET_ATTR_SETNAME]); @@ -609,12 +609,12 @@ ip_set_create(struct sock *ctnl, struct sk_buff *skb, */ if ((ret = find_free_id(set->name, &index, &clash)) != 0) { /* If this is the same set and requested, ignore error */ - if (ret == -EEXIST - && (flags & IPSET_FLAG_EXIST) - && STREQ(set->type->name, clash->type->name) - && set->type->family == clash->type->family - && set->type->revision == clash->type->revision - && set->variant->same_set(set, clash)) + if (ret == -EEXIST && + (flags & IPSET_FLAG_EXIST) && + STREQ(set->type->name, clash->type->name) && + set->type->family == clash->type->family && + set->type->revision == clash->type->revision && + set->variant->same_set(set, clash)) ret = 0; goto cleanup; } @@ -672,8 +672,8 @@ ip_set_destroy(struct sock *ctnl, struct sk_buff *skb, /* References are protected by the nfnl mutex */ if (!attr[IPSET_ATTR_SETNAME]) { for (i = 0; i < ip_set_max; i++) { - if (ip_set_list[i] != NULL - && (atomic_read(&ip_set_list[i]->ref))) + if (ip_set_list[i] != NULL && + (atomic_read(&ip_set_list[i]->ref))) return -IPSET_ERR_BUSY; } for (i = 0; i < ip_set_max; i++) { @@ -749,9 +749,9 @@ ip_set_rename(struct sock *ctnl, struct sk_buff *skb, const char *name2; ip_set_id_t i; - if (unlikely(protocol_failed(attr) - || attr[IPSET_ATTR_SETNAME] == NULL - || attr[IPSET_ATTR_SETNAME2] == NULL)) + if (unlikely(protocol_failed(attr) || + attr[IPSET_ATTR_SETNAME] == NULL || + attr[IPSET_ATTR_SETNAME2] == NULL)) return -IPSET_ERR_PROTOCOL; set = find_set(nla_data(attr[IPSET_ATTR_SETNAME])); @@ -762,8 +762,8 @@ ip_set_rename(struct sock *ctnl, struct sk_buff *skb, name2 = nla_data(attr[IPSET_ATTR_SETNAME2]); for (i = 0; i < ip_set_max; i++) { - if (ip_set_list[i] != NULL - && STREQ(ip_set_list[i]->name, name2)) + if (ip_set_list[i] != NULL && + STREQ(ip_set_list[i]->name, name2)) return -IPSET_ERR_EXIST_SETNAME2; } strncpy(set->name, name2, IPSET_MAXNAMELEN); @@ -790,9 +790,9 @@ ip_set_swap(struct sock *ctnl, struct sk_buff *skb, char from_name[IPSET_MAXNAMELEN]; u32 from_ref; - if (unlikely(protocol_failed(attr) - || attr[IPSET_ATTR_SETNAME] == NULL - || attr[IPSET_ATTR_SETNAME2] == NULL)) + if (unlikely(protocol_failed(attr) || + attr[IPSET_ATTR_SETNAME] == NULL || + attr[IPSET_ATTR_SETNAME2] == NULL)) return -IPSET_ERR_PROTOCOL; from_id = find_set_id(nla_data(attr[IPSET_ATTR_SETNAME])); @@ -809,8 +809,8 @@ ip_set_swap(struct sock *ctnl, struct sk_buff *skb, /* Features must not change. * Not an artifical restriction anymore, as we must prevent * possible loops created by swapping in setlist type of sets. */ - if (!(from->type->features == to->type->features - && from->type->family == to->type->family)) + if (!(from->type->features == to->type->features && + from->type->family == to->type->family)) return -IPSET_ERR_TYPE_MISMATCH; /* No magic here: ref munging protected by the nfnl_lock */ @@ -926,9 +926,9 @@ ip_set_dump_start(struct sk_buff *skb, struct netlink_callback *cb) /* When dumping all sets, we must dump "sorted" * so that lists (unions of sets) are dumped last. */ - if (cb->args[0] != DUMP_ONE - && !((cb->args[0] == DUMP_ALL) - ^ (set->type->features & IPSET_DUMP_LAST))) + if (cb->args[0] != DUMP_ONE && + !((cb->args[0] == DUMP_ALL) ^ + (set->type->features & IPSET_DUMP_LAST))) continue; pr_debug("List set: %s", set->name); if (!cb->args[2]) { @@ -1036,9 +1036,9 @@ call_ad(struct sk_buff *skb, const struct nlattr *const attr[], ret = set->variant->uadt(set, head, len, adt, &lineno, flags); write_unlock_bh(&set->lock); - } while (ret == -EAGAIN - && set->variant->resize - && (ret = set->variant->resize(set, retried++)) == 0); + } while (ret == -EAGAIN && + set->variant->resize && + (ret = set->variant->resize(set, retried++)) == 0); if (!ret || (ret == -IPSET_ERR_EXIST && eexist)) return 0; @@ -1062,15 +1062,15 @@ ip_set_uadd(struct sock *ctnl, struct sk_buff *skb, u32 flags = flag_exist(nlh); int ret = 0; - if (unlikely(protocol_failed(attr) - || attr[IPSET_ATTR_SETNAME] == NULL - || !((attr[IPSET_ATTR_DATA] != NULL) - ^ (attr[IPSET_ATTR_ADT] != NULL)) - || (attr[IPSET_ATTR_DATA] != NULL - && !flag_nested(attr[IPSET_ATTR_DATA])) - || (attr[IPSET_ATTR_ADT] != NULL - && (!flag_nested(attr[IPSET_ATTR_ADT]) - || attr[IPSET_ATTR_LINENO] == NULL)))) + if (unlikely(protocol_failed(attr) || + attr[IPSET_ATTR_SETNAME] == NULL || + !((attr[IPSET_ATTR_DATA] != NULL) ^ + (attr[IPSET_ATTR_ADT] != NULL)) || + (attr[IPSET_ATTR_DATA] != NULL && + !flag_nested(attr[IPSET_ATTR_DATA])) || + (attr[IPSET_ATTR_ADT] != NULL && + (!flag_nested(attr[IPSET_ATTR_ADT]) || + attr[IPSET_ATTR_LINENO] == NULL)))) return -IPSET_ERR_PROTOCOL; set = find_set(nla_data(attr[IPSET_ATTR_SETNAME])); @@ -1084,8 +1084,8 @@ ip_set_uadd(struct sock *ctnl, struct sk_buff *skb, int nla_rem; nla_for_each_nested(nla, attr[IPSET_ATTR_ADT], nla_rem) { - if (nla_type(nla) != IPSET_ATTR_DATA - || !flag_nested(nla)) + if (nla_type(nla) != IPSET_ATTR_DATA || + !flag_nested(nla)) return -IPSET_ERR_PROTOCOL; ret = call_ad(skb, attr, set, nla, IPSET_ADD, flags); @@ -1106,15 +1106,15 @@ ip_set_udel(struct sock *ctnl, struct sk_buff *skb, u32 flags = flag_exist(nlh); int ret = 0; - if (unlikely(protocol_failed(attr) - || attr[IPSET_ATTR_SETNAME] == NULL - || !((attr[IPSET_ATTR_DATA] != NULL) - ^ (attr[IPSET_ATTR_ADT] != NULL)) - || (attr[IPSET_ATTR_DATA] != NULL - && !flag_nested(attr[IPSET_ATTR_DATA])) - || (attr[IPSET_ATTR_ADT] != NULL - && (!flag_nested(attr[IPSET_ATTR_ADT]) - || attr[IPSET_ATTR_LINENO] == NULL)))) + if (unlikely(protocol_failed(attr) || + attr[IPSET_ATTR_SETNAME] == NULL || + !((attr[IPSET_ATTR_DATA] != NULL) ^ + (attr[IPSET_ATTR_ADT] != NULL)) || + (attr[IPSET_ATTR_DATA] != NULL && + !flag_nested(attr[IPSET_ATTR_DATA])) || + (attr[IPSET_ATTR_ADT] != NULL && + (!flag_nested(attr[IPSET_ATTR_ADT]) || + attr[IPSET_ATTR_LINENO] == NULL)))) return -IPSET_ERR_PROTOCOL; set = find_set(nla_data(attr[IPSET_ATTR_SETNAME])); @@ -1128,8 +1128,8 @@ ip_set_udel(struct sock *ctnl, struct sk_buff *skb, int nla_rem; nla_for_each_nested(nla, attr[IPSET_ATTR_ADT], nla_rem) { - if (nla_type(nla) != IPSET_ATTR_DATA - || !flag_nested(nla)) + if (nla_type(nla) != IPSET_ATTR_DATA || + !flag_nested(nla)) return -IPSET_ERR_PROTOCOL; ret = call_ad(skb, attr, set, nla, IPSET_DEL, flags); @@ -1148,10 +1148,10 @@ ip_set_utest(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set; int ret = 0; - if (unlikely(protocol_failed(attr) - || attr[IPSET_ATTR_SETNAME] == NULL - || attr[IPSET_ATTR_DATA] == NULL - || !flag_nested(attr[IPSET_ATTR_DATA]))) + if (unlikely(protocol_failed(attr) || + attr[IPSET_ATTR_SETNAME] == NULL || + attr[IPSET_ATTR_DATA] == NULL || + !flag_nested(attr[IPSET_ATTR_DATA]))) return -IPSET_ERR_PROTOCOL; set = find_set(nla_data(attr[IPSET_ATTR_SETNAME])); @@ -1184,8 +1184,8 @@ ip_set_header(struct sock *ctnl, struct sk_buff *skb, ip_set_id_t index; int ret = 0; - if (unlikely(protocol_failed(attr) - || attr[IPSET_ATTR_SETNAME] == NULL)) + if (unlikely(protocol_failed(attr) || + attr[IPSET_ATTR_SETNAME] == NULL)) return -IPSET_ERR_PROTOCOL; index = find_set_id(nla_data(attr[IPSET_ATTR_SETNAME])); @@ -1241,9 +1241,9 @@ ip_set_type(struct sock *ctnl, struct sk_buff *skb, const char *typename; int ret = 0; - if (unlikely(protocol_failed(attr) - || attr[IPSET_ATTR_TYPENAME] == NULL - || attr[IPSET_ATTR_FAMILY] == NULL)) + if (unlikely(protocol_failed(attr) || + attr[IPSET_ATTR_TYPENAME] == NULL || + attr[IPSET_ATTR_FAMILY] == NULL)) return -IPSET_ERR_PROTOCOL; family = nla_get_u8(attr[IPSET_ATTR_FAMILY]); @@ -1469,8 +1469,8 @@ ip_set_sockfn_get(struct sock *sk, int optval, void *user, int *len) case IP_SET_OP_GET_BYINDEX: { struct ip_set_req_get_set *req_get = data; - if (*len != sizeof(struct ip_set_req_get_set) - || req_get->set.index >= ip_set_max) { + if (*len != sizeof(struct ip_set_req_get_set) || + req_get->set.index >= ip_set_max) { ret = -EINVAL; goto done; } diff --git a/kernel/ip_set_hash_ip.c b/kernel/ip_set_hash_ip.c index f07f14b..b374462 100644 --- a/kernel/ip_set_hash_ip.c +++ b/kernel/ip_set_hash_ip.c @@ -215,9 +215,9 @@ hash_ip_same_set(const struct ip_set *a, const struct ip_set *b) const struct ip_set_hash *y = b->data; /* Resizing changes htable_bits, so we ignore it */ - return x->maxelem == y->maxelem - && x->timeout == y->timeout - && x->netmask == y->netmask; + return x->maxelem == y->maxelem && + x->timeout == y->timeout && + x->netmask == y->netmask; } /* The type variant functions: IPv6 */ @@ -408,9 +408,9 @@ hash_ip_create(struct ip_set *set, struct nlattr *head, int len, u32 flags) if (tb[IPSET_ATTR_NETMASK]) { netmask = nla_get_u8(tb[IPSET_ATTR_NETMASK]); - if ((set->family == AF_INET && netmask > 32) - || (set->family == AF_INET6 && netmask > 128) - || netmask == 0) + if ((set->family == AF_INET && netmask > 32) || + (set->family == AF_INET6 && netmask > 128) || + netmask == 0) return -IPSET_ERR_INVALID_NETMASK; } diff --git a/kernel/ip_set_hash_ipport.c b/kernel/ip_set_hash_ipport.c index 891d045..6953042 100644 --- a/kernel/ip_set_hash_ipport.c +++ b/kernel/ip_set_hash_ipport.c @@ -66,9 +66,9 @@ static inline bool hash_ipport4_data_equal(const struct hash_ipport4_elem *ip1, const struct hash_ipport4_elem *ip2) { - return ip1->ip == ip2->ip - && ip1->port == ip2->port - && ip1->proto == ip2->proto; + return ip1->ip == ip2->ip && + ip1->port == ip2->port && + ip1->proto == ip2->proto; } static inline bool @@ -218,10 +218,10 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *head, int len, timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); } - if (adt == IPSET_TEST - || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) - || !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR] - || tb[IPSET_ATTR_PORT_TO])) { + if (adt == IPSET_TEST || + !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) || + !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR] || + tb[IPSET_ATTR_PORT_TO])) { ret = adtfn(set, &data, timeout); return ip_set_eexist(ret, flags) ? 0 : ret; } @@ -273,8 +273,8 @@ hash_ipport_same_set(const struct ip_set *a, const struct ip_set *b) const struct ip_set_hash *y = b->data; /* Resizing changes htable_bits, so we ignore it */ - return x->maxelem == y->maxelem - && x->timeout == y->timeout; + return x->maxelem == y->maxelem && + x->timeout == y->timeout; } /* The type variant functions: IPv6 */ @@ -298,9 +298,9 @@ static inline bool hash_ipport6_data_equal(const struct hash_ipport6_elem *ip1, const struct hash_ipport6_elem *ip2) { - return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 - && ip1->port == ip2->port - && ip1->proto == ip2->proto; + return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 && + ip1->port == ip2->port && + ip1->proto == ip2->proto; } static inline bool @@ -440,9 +440,9 @@ hash_ipport6_uadt(struct ip_set *set, struct nlattr *head, int len, timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); } - if (adt == IPSET_TEST - || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) - || !tb[IPSET_ATTR_PORT_TO]) { + if (adt == IPSET_TEST || + !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) || + !tb[IPSET_ATTR_PORT_TO]) { ret = adtfn(set, &data, timeout); return ip_set_eexist(ret, flags) ? 0 : ret; } diff --git a/kernel/ip_set_hash_ipportip.c b/kernel/ip_set_hash_ipportip.c index 264fe9e..94c6634 100644 --- a/kernel/ip_set_hash_ipportip.c +++ b/kernel/ip_set_hash_ipportip.c @@ -68,10 +68,10 @@ static inline bool hash_ipportip4_data_equal(const struct hash_ipportip4_elem *ip1, const struct hash_ipportip4_elem *ip2) { - return ip1->ip == ip2->ip - && ip1->ip2 == ip2->ip2 - && ip1->port == ip2->port - && ip1->proto == ip2->proto; + return ip1->ip == ip2->ip && + ip1->ip2 == ip2->ip2 && + ip1->port == ip2->port && + ip1->proto == ip2->proto; } static inline bool @@ -229,10 +229,10 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *head, int len, timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); } - if (adt == IPSET_TEST - || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) - || !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR] - || tb[IPSET_ATTR_PORT_TO])) { + if (adt == IPSET_TEST || + !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) || + !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR] || + tb[IPSET_ATTR_PORT_TO])) { ret = adtfn(set, &data, timeout); return ip_set_eexist(ret, flags) ? 0 : ret; } @@ -284,8 +284,8 @@ hash_ipportip_same_set(const struct ip_set *a, const struct ip_set *b) const struct ip_set_hash *y = b->data; /* Resizing changes htable_bits, so we ignore it */ - return x->maxelem == y->maxelem - && x->timeout == y->timeout; + return x->maxelem == y->maxelem && + x->timeout == y->timeout; } /* The type variant functions: IPv6 */ @@ -311,10 +311,10 @@ static inline bool hash_ipportip6_data_equal(const struct hash_ipportip6_elem *ip1, const struct hash_ipportip6_elem *ip2) { - return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 - && ipv6_addr_cmp(&ip1->ip2.in6, &ip2->ip2.in6) == 0 - && ip1->port == ip2->port - && ip1->proto == ip2->proto; + return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 && + ipv6_addr_cmp(&ip1->ip2.in6, &ip2->ip2.in6) == 0 && + ip1->port == ip2->port && + ip1->proto == ip2->proto; } static inline bool @@ -461,9 +461,9 @@ hash_ipportip6_uadt(struct ip_set *set, struct nlattr *head, int len, timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); } - if (adt == IPSET_TEST - || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) - || !tb[IPSET_ATTR_PORT_TO]) { + if (adt == IPSET_TEST || + !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) || + !tb[IPSET_ATTR_PORT_TO]) { ret = adtfn(set, &data, timeout); return ip_set_eexist(ret, flags) ? 0 : ret; } diff --git a/kernel/ip_set_hash_ipportnet.c b/kernel/ip_set_hash_ipportnet.c index b9aea43..0768981 100644 --- a/kernel/ip_set_hash_ipportnet.c +++ b/kernel/ip_set_hash_ipportnet.c @@ -68,11 +68,11 @@ static inline bool hash_ipportnet4_data_equal(const struct hash_ipportnet4_elem *ip1, const struct hash_ipportnet4_elem *ip2) { - return ip1->ip == ip2->ip - && ip1->ip2 == ip2->ip2 - && ip1->cidr == ip2->cidr - && ip1->port == ip2->port - && ip1->proto == ip2->proto; + return ip1->ip == ip2->ip && + ip1->ip2 == ip2->ip2 && + ip1->cidr == ip2->cidr && + ip1->port == ip2->port && + ip1->proto == ip2->proto; } static inline bool @@ -258,10 +258,10 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *head, int len, timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); } - if (adt == IPSET_TEST - || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) - || !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR] - || tb[IPSET_ATTR_PORT_TO])) { + if (adt == IPSET_TEST || + !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) || + !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR] || + tb[IPSET_ATTR_PORT_TO])) { ret = adtfn(set, &data, timeout); return ip_set_eexist(ret, flags) ? 0 : ret; } @@ -313,8 +313,8 @@ hash_ipportnet_same_set(const struct ip_set *a, const struct ip_set *b) const struct ip_set_hash *y = b->data; /* Resizing changes htable_bits, so we ignore it */ - return x->maxelem == y->maxelem - && x->timeout == y->timeout; + return x->maxelem == y->maxelem && + x->timeout == y->timeout; } /* The type variant functions: IPv6 */ @@ -340,11 +340,11 @@ static inline bool hash_ipportnet6_data_equal(const struct hash_ipportnet6_elem *ip1, const struct hash_ipportnet6_elem *ip2) { - return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 - && ipv6_addr_cmp(&ip1->ip2.in6, &ip2->ip2.in6) == 0 - && ip1->cidr == ip2->cidr - && ip1->port == ip2->port - && ip1->proto == ip2->proto; + return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 && + ipv6_addr_cmp(&ip1->ip2.in6, &ip2->ip2.in6) == 0 && + ip1->cidr == ip2->cidr && + ip1->port == ip2->port && + ip1->proto == ip2->proto; } static inline bool @@ -524,9 +524,9 @@ hash_ipportnet6_uadt(struct ip_set *set, struct nlattr *head, int len, timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); } - if (adt == IPSET_TEST - || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) - || !tb[IPSET_ATTR_PORT_TO]) { + if (adt == IPSET_TEST || + !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) || + !tb[IPSET_ATTR_PORT_TO]) { ret = adtfn(set, &data, timeout); return ip_set_eexist(ret, flags) ? 0 : ret; } diff --git a/kernel/ip_set_hash_net.c b/kernel/ip_set_hash_net.c index a249e07..e7f4016 100644 --- a/kernel/ip_set_hash_net.c +++ b/kernel/ip_set_hash_net.c @@ -210,8 +210,8 @@ hash_net_same_set(const struct ip_set *a, const struct ip_set *b) const struct ip_set_hash *y = b->data; /* Resizing changes htable_bits, so we ignore it */ - return x->maxelem == y->maxelem - && x->timeout == y->timeout; + return x->maxelem == y->maxelem && + x->timeout == y->timeout; } /* The type variant functions: IPv6 */ @@ -235,8 +235,8 @@ static inline bool hash_net6_data_equal(const struct hash_net6_elem *ip1, const struct hash_net6_elem *ip2) { - return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 - && ip1->cidr == ip2->cidr; + return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 && + ip1->cidr == ip2->cidr; } static inline bool diff --git a/kernel/ip_set_hash_netport.c b/kernel/ip_set_hash_netport.c index ebcb73d..d17f077 100644 --- a/kernel/ip_set_hash_netport.c +++ b/kernel/ip_set_hash_netport.c @@ -65,10 +65,10 @@ static inline bool hash_netport4_data_equal(const struct hash_netport4_elem *ip1, const struct hash_netport4_elem *ip2) { - return ip1->ip == ip2->ip - && ip1->port == ip2->port - && ip1->proto == ip2->proto - && ip1->cidr == ip2->cidr; + return ip1->ip == ip2->ip && + ip1->port == ip2->port && + ip1->proto == ip2->proto && + ip1->cidr == ip2->cidr; } static inline bool @@ -244,9 +244,9 @@ hash_netport4_uadt(struct ip_set *set, struct nlattr *head, int len, timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); } - if (adt == IPSET_TEST - || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) - || !tb[IPSET_ATTR_PORT_TO]) { + if (adt == IPSET_TEST || + !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) || + !tb[IPSET_ATTR_PORT_TO]) { ret = adtfn(set, &data, timeout); return ip_set_eexist(ret, flags) ? 0 : ret; } @@ -275,8 +275,8 @@ hash_netport_same_set(const struct ip_set *a, const struct ip_set *b) const struct ip_set_hash *y = b->data; /* Resizing changes htable_bits, so we ignore it */ - return x->maxelem == y->maxelem - && x->timeout == y->timeout; + return x->maxelem == y->maxelem && + x->timeout == y->timeout; } /* The type variant functions: IPv6 */ @@ -300,10 +300,10 @@ static inline bool hash_netport6_data_equal(const struct hash_netport6_elem *ip1, const struct hash_netport6_elem *ip2) { - return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 - && ip1->port == ip2->port - && ip1->proto == ip2->proto - && ip1->cidr == ip2->cidr; + return ipv6_addr_cmp(&ip1->ip.in6, &ip2->ip.in6) == 0 && + ip1->port == ip2->port && + ip1->proto == ip2->proto && + ip1->cidr == ip2->cidr; } static inline bool @@ -474,9 +474,9 @@ hash_netport6_uadt(struct ip_set *set, struct nlattr *head, int len, timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]); } - if (adt == IPSET_TEST - || !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) - || !tb[IPSET_ATTR_PORT_TO]) { + if (adt == IPSET_TEST || + !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) || + !tb[IPSET_ATTR_PORT_TO]) { ret = adtfn(set, &data, timeout); return ip_set_eexist(ret, flags) ? 0 : ret; } diff --git a/kernel/ip_set_list_set.c b/kernel/ip_set_list_set.c index 770c39d..486e6a9 100644 --- a/kernel/ip_set_list_set.c +++ b/kernel/ip_set_list_set.c @@ -68,8 +68,8 @@ list_set_expired(const struct list_set *map, u32 id) static inline int list_set_exist(const struct set_telem *elem) { - return elem->id != IPSET_INVALID_ID - && !ip_set_timeout_expired(elem->timeout); + return elem->id != IPSET_INVALID_ID && + !ip_set_timeout_expired(elem->timeout); } /* Set list without and with timeout */ @@ -129,9 +129,9 @@ next_id_eq(const struct list_set *map, u32 i, ip_set_id_t id) if (i + 1 < map->size) { elem = list_set_elem(map, i + 1); - return !!(elem->id == id - && !(with_timeout(map->timeout) - && list_set_expired(map, i + 1))); + return !!(elem->id == id && + !(with_timeout(map->timeout) && + list_set_expired(map, i + 1))); } return 0; @@ -270,8 +270,8 @@ list_set_uadt(struct ip_set *set, struct nlattr *head, int len, case IPSET_TEST: for (i = 0; i < map->size && !ret; i++) { elem = list_set_elem(map, i); - if (elem->id == IPSET_INVALID_ID - || (before != 0 && i + 1 >= map->size)) + if (elem->id == IPSET_INVALID_ID || + (before != 0 && i + 1 >= map->size)) break; else if (with_timeout && list_set_expired(map, i)) continue; @@ -286,8 +286,8 @@ list_set_uadt(struct ip_set *set, struct nlattr *head, int len, case IPSET_ADD: for (i = 0; i < map->size && !ret; i++) { elem = list_set_elem(map, i); - if (elem->id == id - && !(with_timeout && list_set_expired(map, i))) + if (elem->id == id && + !(with_timeout && list_set_expired(map, i))) ret = -IPSET_ERR_EXIST; } if (ret == -IPSET_ERR_EXIST) @@ -318,14 +318,14 @@ list_set_uadt(struct ip_set *set, struct nlattr *head, int len, break; } else if (with_timeout && list_set_expired(map, i)) continue; - else if (elem->id == id - && (before == 0 - || (before > 0 - && next_id_eq(map, i, refid)))) + else if (elem->id == id && + (before == 0 || + (before > 0 && + next_id_eq(map, i, refid)))) ret = list_set_del(map, id, i); - else if (before < 0 - && elem->id == refid - && next_id_eq(map, i, id)) + else if (before < 0 && + elem->id == refid && + next_id_eq(map, i, id)) ret = list_set_del(map, id, i + 1); } break; @@ -449,8 +449,8 @@ list_set_same_set(const struct ip_set *a, const struct ip_set *b) const struct list_set *x = a->data; const struct list_set *y = b->data; - return x->size == y->size - && x->timeout == y->timeout; + return x->size == y->size && + x->timeout == y->timeout; } static const struct ip_set_type_variant list_set = { @@ -476,8 +476,8 @@ list_set_gc(unsigned long ul_set) read_lock_bh(&set->lock); for (i = map->size - 1; i >= 0; i--) { e = (struct set_telem *) list_set_elem(map, i); - if (e->id != IPSET_INVALID_ID - && list_set_expired(map, i)) + if (e->id != IPSET_INVALID_ID && + list_set_expired(map, i)) list_set_del(map, e->id, i); } read_unlock_bh(&set->lock); diff --git a/kernel/xt_set.c b/kernel/xt_set.c index fdd1876..d580c6c 100644 --- a/kernel/xt_set.c +++ b/kernel/xt_set.c @@ -181,8 +181,8 @@ set_target_v0_checkentry(const struct xt_tgchk_param *par) return CHECK_FAIL; /* error */ } } - if (info->add_set.u.flags[IPSET_DIM_MAX-1] != 0 - || info->del_set.u.flags[IPSET_DIM_MAX-1] != 0) { + if (info->add_set.u.flags[IPSET_DIM_MAX-1] != 0 || + info->del_set.u.flags[IPSET_DIM_MAX-1] != 0) { pr_warning("That's nasty!"); return CHECK_FAIL; /* error */ } @@ -309,8 +309,8 @@ set_target_checkentry(const struct xt_tgchk_param *par) return CHECK_FAIL; /* error */ } } - if (info->add_set.dim > IPSET_DIM_MAX - || info->del_set.flags > IPSET_DIM_MAX) { + if (info->add_set.dim > IPSET_DIM_MAX || + info->del_set.flags > IPSET_DIM_MAX) { pr_warning("That's nasty!"); return CHECK_FAIL; /* error */ } |