Skip to content

Commit

Permalink
netfilter: conntrack: Use max() instead of doing it manually
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jiapeng Chong authored and Pablo Neira Ayuso committed Jan 9, 2022
1 parent 2b71e2c commit 613a0c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/net/netfilter/nf_conntrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 613a0c6

Please sign in to comment.