summaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2021-01-04 17:32:21 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2021-04-25 05:25:16 +0900
commitd8fc9b667d483614974d80f59405f0db4dfc72e2 (patch)
tree1ef1e126f28e5b90e786efa595cb8989560f7cd9 /fs/proc
parentc3d7ef377eb2564b165b1e8fdb4646952c90ac17 (diff)
downloadlinux-d8fc9b667d483614974d80f59405f0db4dfc72e2.tar.gz
linux-d8fc9b667d483614974d80f59405f0db4dfc72e2.tar.bz2
linux-d8fc9b667d483614974d80f59405f0db4dfc72e2.zip
sysctl: use min() helper for namecmp()
Make it slightly readable by using min(). Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Acked-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/proc_sysctl.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 984e42f8cb11..d25e8264099a 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -94,14 +94,9 @@ static void sysctl_print_dir(struct ctl_dir *dir)
static int namecmp(const char *name1, int len1, const char *name2, int len2)
{
- int minlen;
int cmp;
- minlen = len1;
- if (minlen > len2)
- minlen = len2;
-
- cmp = memcmp(name1, name2, minlen);
+ cmp = memcmp(name1, name2, min(len1, len2));
if (cmp == 0)
cmp = len1 - len2;
return cmp;