]> git.baikalelectronics.ru Git - kernel.git/commitdiff
netfilter: conntrack: Use max() instead of doing it manually
authorJiapeng Chong <jiapeng.chong@linux.alibaba.com>
Sat, 25 Dec 2021 17:12:41 +0000 (01:12 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 9 Jan 2022 22:30:13 +0000 (23:30 +0100)
Fix following coccicheck warning:

./include/net/netfilter/nf_conntrack.h:282:16-17: WARNING opportunity
for max().

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_conntrack.h

index 871489df63c6470ff899da113806a695d826a129..a4a14f3a5e3893397c831ce4fd8add71afeaf2bc 100644 (file)
@@ -279,7 +279,7 @@ static inline unsigned long nf_ct_expires(const struct nf_conn *ct)
 {
        s32 timeout = READ_ONCE(ct->timeout) - nfct_time_stamp;
 
-       return timeout > 0 ? timeout : 0;
+       return max(timeout, 0);
 }
 
 static inline bool nf_ct_is_expired(const struct nf_conn *ct)