mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:46:16 +00:00
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. Link: https://lkml.kernel.org/r/20240820042254.99115-2-thorsten.blum@toblux.com Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> Reviewed-by: Muchun Song <muchun.song@linux.dev> Cc: Dave Chinner <david@fromorbit.com> Cc: Qi Zheng <zhengqi.arch@bytedance.com> Cc: Roman Gushchin <roman.gushchin@linux.dev> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
2e6d88e9d4
commit
49029c4db3
@ -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';
|
||||
|
Loading…
Reference in New Issue
Block a user