[PATCH] mm: shrinker: Use min() to improve shrinker_debugfs_scan_write()

Thorsten Blum
2024-08-20T16:24:59Z

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