[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202103011546.9AA6D832@keescook>
Date: Mon, 1 Mar 2021 15:47:09 -0800
From: Kees Cook <keescook@...omium.org>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: Luis Chamberlain <mcgrof@...nel.org>,
Iurii Zaikin <yzaikin@...gle.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Linux FS-devel Mailing List <linux-fsdevel@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] sysctl: use min() helper for namecmp()
On Sun, Feb 28, 2021 at 04:44:22PM +0900, Masahiro Yamada wrote:
> (CC: Andrew Morton)
>
> A friendly reminder.
>
>
> This is just a minor clean-up.
>
> If nobody picks it up,
> I hope perhaps Andrew Morton will do.
>
> This patch:
> https://lore.kernel.org/patchwork/patch/1360092/
>
>
>
>
>
> On Mon, Jan 4, 2021 at 5:33 PM Masahiro Yamada <masahiroy@...nel.org> wrote:
> >
> > Make it slightly readable by using min().
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
Acked-by: Kees Cook <keescook@...omium.org>
Feel free to take this via your tree Masahiro. Thanks!
-Kees
> > ---
> >
> > fs/proc/proc_sysctl.c | 7 +------
> > 1 file changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
> > index 317899222d7f..86341c0f0c40 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;
> > --
> > 2.27.0
> >
>
>
> --
> Best Regards
> Masahiro Yamada
--
Kees Cook
Reviewed-by: Kees Cook <keescook@...omium.org>
--
Kees Cook
Powered by blists - more mailing lists