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-next>] [day] [month] [year] [list]
Message-ID: <20240820042254.99115-2-thorsten.blum@toblux.com>
Date: Tue, 20 Aug 2024 06:22:55 +0200
From: Thorsten Blum <thorsten.blum@...lux.com>
To: akpm@...ux-foundation.org,
	david@...morbit.com,
	zhengqi.arch@...edance.com,
	roman.gushchin@...ux.dev,
	muchun.song@...ux.dev
Cc: linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Thorsten Blum <thorsten.blum@...lux.com>
Subject: [PATCH] mm: shrinker: Use min() to improve shrinker_debugfs_scan_write()

Use the min() macro to simplify the shrinker_debugfs_scan_write()
function and improve its readability.

Signed-off-by: Thorsten Blum <thorsten.blum@...lux.com>
---
 mm/shrinker_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/shrinker_debug.c b/mm/shrinker_debug.c
index 12ea5486a3e9..4a85b94d12ce 100644
--- a/mm/shrinker_debug.c
+++ b/mm/shrinker_debug.c
@@ -114,7 +114,7 @@ static ssize_t shrinker_debugfs_scan_write(struct file *file,
 	int nid;
 	char kbuf[72];
 
-	read_len = size < (sizeof(kbuf) - 1) ? size : (sizeof(kbuf) - 1);
+	read_len = min(size, sizeof(kbuf) - 1);
 	if (copy_from_user(kbuf, buf, read_len))
 		return -EFAULT;
 	kbuf[read_len] = '\0';
-- 
2.46.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ