lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250426100445.57221-1-thorsten.blum@linux.dev>
Date: Sat, 26 Apr 2025 12:04:44 +0200
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Jon Maloy <jmaloy@...hat.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Simon Horman <horms@...nel.org>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
	netdev@...r.kernel.org,
	tipc-discussion@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org
Subject: [PATCH net-next] tipc: Replace msecs_to_jiffies() with secs_to_jiffies()

Use secs_to_jiffies() instead of msecs_to_jiffies() and avoid scaling
'delay' to milliseconds in tipc_crypto_rekeying_sched(). Compared to
msecs_to_jiffies(), secs_to_jiffies() expands to simpler code and
reduces the size of 'tipc.ko'.

Remove unnecessary parentheses around the local variable 'now'.

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
---
 net/tipc/crypto.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/tipc/crypto.c b/net/tipc/crypto.c
index c524421ec652..45edb29b6bd7 100644
--- a/net/tipc/crypto.c
+++ b/net/tipc/crypto.c
@@ -41,10 +41,10 @@
 #include "msg.h"
 #include "bcast.h"
 
-#define TIPC_TX_GRACE_PERIOD	msecs_to_jiffies(5000) /* 5s */
-#define TIPC_TX_LASTING_TIME	msecs_to_jiffies(10000) /* 10s */
-#define TIPC_RX_ACTIVE_LIM	msecs_to_jiffies(3000) /* 3s */
-#define TIPC_RX_PASSIVE_LIM	msecs_to_jiffies(15000) /* 15s */
+#define TIPC_TX_GRACE_PERIOD	secs_to_jiffies(5)
+#define TIPC_TX_LASTING_TIME	secs_to_jiffies(10)
+#define TIPC_RX_ACTIVE_LIM	secs_to_jiffies(3)
+#define TIPC_RX_PASSIVE_LIM	secs_to_jiffies(15)
 
 #define TIPC_MAX_TFMS_DEF	10
 #define TIPC_MAX_TFMS_LIM	1000
@@ -2348,7 +2348,7 @@ static void tipc_crypto_work_rx(struct work_struct *work)
 	struct delayed_work *dwork = to_delayed_work(work);
 	struct tipc_crypto *rx = container_of(dwork, struct tipc_crypto, work);
 	struct tipc_crypto *tx = tipc_net(rx->net)->crypto_tx;
-	unsigned long delay = msecs_to_jiffies(5000);
+	unsigned long delay = secs_to_jiffies(5);
 	bool resched = false;
 	u8 key;
 	int rc;
@@ -2418,8 +2418,8 @@ void tipc_crypto_rekeying_sched(struct tipc_crypto *tx, bool changed,
 	}
 
 	if (tx->rekeying_intv || now) {
-		delay = (now) ? 0 : tx->rekeying_intv * 60 * 1000;
-		queue_delayed_work(tx->wq, &tx->work, msecs_to_jiffies(delay));
+		delay = now ? 0 : tx->rekeying_intv * 60;
+		queue_delayed_work(tx->wq, &tx->work, secs_to_jiffies(delay));
 	}
 }
 
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ