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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251119224140.8616-39-david.laight.linux@gmail.com>
Date: Wed, 19 Nov 2025 22:41:34 +0000
From: david.laight.linux@...il.com
To: linux-kernel@...r.kernel.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
	David Laight <david.laight.linux@...il.com>
Subject: [PATCH 38/44] lib/dynamic_queue_limits: use max() instead of max_t()

From: David Laight <david.laight.linux@...il.com>

max_t(unsigned int, a, b) casts an 'unsigned long' to 'unsigned int'.
Use max(a, b) instead as it promotes any 'unsigned int' to 'unsigned long'
and so cannot discard significant bits.

In this case the 'unsigned long' value is small enough that the result
is ok.

Detected by an extra check added to max_t().

Signed-off-by: David Laight <david.laight.linux@...il.com>
---
 lib/dynamic_queue_limits.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/dynamic_queue_limits.c b/lib/dynamic_queue_limits.c
index f97a752e900a..8b9730b1d751 100644
--- a/lib/dynamic_queue_limits.c
+++ b/lib/dynamic_queue_limits.c
@@ -69,7 +69,7 @@ static void dql_check_stall(struct dql *dql, unsigned short stall_thrs)
 			goto dqs_again;
 
 		dql->stall_cnt++;
-		dql->stall_max = max_t(unsigned short, dql->stall_max, now - t);
+		dql->stall_max = max(dql->stall_max, now - t);
 
 		trace_dql_stall_detected(dql->stall_thrs, now - t,
 					 dql->last_reap, dql->history_head,
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ