]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
netfilter: return booleans instead of integers
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Thu, 18 Jan 2018 23:25:12 +0000 (17:25 -0600)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 19 Jan 2018 13:02:18 +0000 (14:02 +0100)
Return statements in functions returning bool should use
true/false instead of 1/0.

These issues were detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_conncount.c
net/netfilter/xt_hashlimit.c
net/netfilter/xt_ipcomp.c

index a95518261168211598fa71b238c1d3fb1c6c3dfd..6d65389e308f4ba10c5eac881758833fe22909d6 100644 (file)
@@ -71,7 +71,7 @@ static inline bool already_closed(const struct nf_conn *conn)
                return conn->proto.tcp.state == TCP_CONNTRACK_TIME_WAIT ||
                       conn->proto.tcp.state == TCP_CONNTRACK_CLOSE;
        else
-               return 0;
+               return false;
 }
 
 static int key_diff(const u32 *a, const u32 *b, unsigned int klen)
index 5da8746f7b88ff4c9446f256e542e823a6a561b0..ec51d9a9512da86493e0246af005bb763d47706f 100644 (file)
@@ -353,7 +353,7 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg,
 static bool select_all(const struct xt_hashlimit_htable *ht,
                       const struct dsthash_ent *he)
 {
-       return 1;
+       return true;
 }
 
 static bool select_gc(const struct xt_hashlimit_htable *ht,
index 000e70377f85dd90fa61203ac4f18abfc62e57ec..7ca64a50db04d0144b8f38f9c5bedb9c30958f6a 100644 (file)
@@ -58,7 +58,7 @@ static bool comp_mt(const struct sk_buff *skb, struct xt_action_param *par)
                 */
                pr_debug("Dropping evil IPComp tinygram.\n");
                par->hotdrop = true;
-               return 0;
+               return false;
        }
 
        return spi_match(compinfo->spis[0], compinfo->spis[1],