* [PATCH] mm: shrinker: Use min() to improve shrinker_debugfs_scan_write()
@ 2024-08-20 4:22 Thorsten Blum
2024-08-21 2:25 ` Muchun Song
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2024-08-20 4:22 UTC (permalink / raw)
To: akpm, david, zhengqi.arch, roman.gushchin, muchun.song
Cc: linux-mm, linux-kernel, Thorsten Blum
Use the min() macro to simplify the shrinker_debugfs_scan_write()
function and improve its readability.
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-21 2:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-20 4:22 [PATCH] mm: shrinker: Use min() to improve shrinker_debugfs_scan_write() Thorsten Blum
2024-08-21 2:25 ` Muchun Song
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox