Skip to contentSkip to conversation

netfilter: return booleans instead of integers

PATCH Applied Gustavo A. R. Silva 2 participants 2 messages Jan 18, 2018 – Jan 19, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: return booleans instead of integers

Return statements in functions returning bool should use true/false instead of 1/0.

These issues were detected with the help of Coccinelle.

---
 net/netfilter/nf_conncount.c | 2 +-
 net/netfilter/xt_hashlimit.c | 2 +-
 net/netfilter/xt_ipcomp.c    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
net/netfilter/nf_conncount.c +1 -1
index a955182..6d65389 100644
@@ -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)
net/netfilter/xt_hashlimit.c +1 -1
index 5da8746..ec51d9a 100644
@@ -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,
net/netfilter/xt_ipcomp.c +1 -1
index 000e703..7ca64a5 100644
@@ -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],
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 4 lines · Gustavo A. R. Silva

Return statements in functions returning bool should use true/false instead of 1/0.

These issues were detected with the help of Coccinelle.

Applied, thanks.