提交 d8fc9b66 编写于 作者: M Masahiro Yamada

sysctl: use min() helper for namecmp()

Make it slightly readable by using min().
Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
Acked-by: NKees Cook <keescook@chromium.org>
上级 c3d7ef37
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册