[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGXu5jJBcWjVKePH9VhPvG9H9xL+iLimESBbQvFaNBiAvGpKww@mail.gmail.com>
Date: Tue, 16 Apr 2019 22:22:36 -0500
From: Kees Cook <keescook@...omium.org>
To: Matteo Croce <mcroce@...hat.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
Luis Chamberlain <mcgrof@...nel.org>,
Kees Cook <keescook@...omium.org>,
Alexey Dobriyan <adobriyan@...il.com>
Subject: Re: [PATCH 2/2] kernel: use sysctl shared variables for range check
On Tue, Apr 16, 2019 at 10:21 PM Kees Cook <keescook@...omium.org> wrote:
>
> On Mon, Apr 8, 2019 at 5:09 PM Matteo Croce <mcroce@...hat.com> wrote:
> >
> > Use the shared variables for range check, instead of declaring a local one
> > in every source file.
> >
> > Signed-off-by: Matteo Croce <mcroce@...hat.com>
> > ---
> > kernel/pid_namespace.c | 3 +-
> > kernel/sysctl.c | 193 ++++++++++++++++++++---------------------
> > kernel/ucount.c | 6 +-
> > 3 files changed, 98 insertions(+), 104 deletions(-)
> >
> > diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
> > index aa6e72fb7c08..ddbb51bc4968 100644
> > --- a/kernel/pid_namespace.c
> > +++ b/kernel/pid_namespace.c
> > @@ -290,14 +290,13 @@ static int pid_ns_ctl_handler(struct ctl_table *table, int write,
> > }
> >
> > extern int pid_max;
> > -static int zero = 0;
> > static struct ctl_table pid_ns_ctl_table[] = {
> > {
> > .procname = "ns_last_pid",
> > .maxlen = sizeof(int),
> > .mode = 0666, /* permissions are checked in the handler */
> > .proc_handler = pid_ns_ctl_handler,
> > - .extra1 = &zero,
> > + .extra1 = (void *)&sysctl_zero,
>
> BTW, I don't think these (void *) casts are actually needed. I thought
> extra1/2 were already void * so assignments don't need the casting.
Nevermind, I see akpm already mentioned this, and I see it's the
"const" removal now.
--
Kees Cook
Powered by blists - more mailing lists