netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: conntrack: Use max() instead of doing it manually
@ 2021-12-25 17:12 Jiapeng Chong
  2022-01-09 22:31 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-12-25 17:12 UTC (permalink / raw)
  To: pablo
  Cc: kadlec, fw, davem, kuba, netfilter-devel, coreteam, netdev,
	linux-kernel, Jiapeng Chong, Abaci Robot

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>
---
 include/net/netfilter/nf_conntrack.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 871489df63c6..a4a14f3a5e38 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -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)
-- 
2.20.1.7.g153144c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] netfilter: conntrack: Use max() instead of doing it manually
  2021-12-25 17:12 [PATCH] netfilter: conntrack: Use max() instead of doing it manually Jiapeng Chong
@ 2022-01-09 22:31 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2022-01-09 22:31 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: kadlec, fw, davem, kuba, netfilter-devel, coreteam, netdev,
	linux-kernel, Abaci Robot

On Sun, Dec 26, 2021 at 01:12:41AM +0800, Jiapeng Chong wrote:
> Fix following coccicheck warning:
> 
> ./include/net/netfilter/nf_conntrack.h:282:16-17: WARNING opportunity
> for max().

Applied to nf-next.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-09 22:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-25 17:12 [PATCH] netfilter: conntrack: Use max() instead of doing it manually Jiapeng Chong
2022-01-09 22:31 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).