Skip to contentSkip to conversation

netfilter: Remove unnecessary conversion to bool

PATCH Applied [email protected] 2 participants 2 messages Nov 6, 2020 – Dec 1, 2020

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: Remove unnecessary conversion to bool

From: Kaixu Xia <[email protected]>

Here we could use the '!=' expression to fix the following coccicheck warning:

./net/netfilter/xt_nfacct.c:30:41-46: WARNING: conversion to bool not needed here

---
 net/netfilter/xt_nfacct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/xt_nfacct.c +1 -1
index a97c2259bbc8..7c6bf1c16813 100644
@@ -27,7 +27,7 @@ static bool nfacct_mt(const struct sk_buff *skb, struct xt_action_param *par)
 
 	overquota = nfnl_acct_overquota(xt_net(par), info->nfacct);
 
-	return overquota == NFACCT_UNDERQUOTA ? false : true;
+	return overquota != NFACCT_UNDERQUOTA;
 }
 
 static int
Signature · 1 line
2.20.0
maintainer Applied
#1 lore raw
Quoted 6 lines · On Fri, Nov 06, 2020 at 04:20:13PM +0800, [email protected] wrote:

From: Kaixu Xia <[email protected]>

Here we could use the '!=' expression to fix the following coccicheck warning:

./net/netfilter/xt_nfacct.c:30:41-46: WARNING: conversion to bool not needed here

Applied.