linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Matteo Croce <mcroce@redhat.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Alexey Dobriyan <adobriyan@gmail.com>
Subject: Re: [PATCH 2/2] kernel: use sysctl shared variables for range check
Date: Tue, 16 Apr 2019 22:22:36 -0500	[thread overview]
Message-ID: <CAGXu5jJBcWjVKePH9VhPvG9H9xL+iLimESBbQvFaNBiAvGpKww@mail.gmail.com> (raw)
In-Reply-To: <CAGXu5jKfWV=FXCoKORTdLooMxLCkzscPcq75HkM4EBGyvcVHkQ@mail.gmail.com>

On Tue, Apr 16, 2019 at 10:21 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Mon, Apr 8, 2019 at 5:09 PM Matteo Croce <mcroce@redhat.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@redhat.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

      reply	other threads:[~2019-04-17  3:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08 22:09 [PATCH 0/2] sysctl: share commonly used constants Matteo Croce
2019-04-08 22:09 ` [PATCH 1/2] proc/sysctl: add shared variables for range check Matteo Croce
2019-04-10 22:18   ` Kees Cook
2019-04-08 22:09 ` [PATCH 2/2] kernel: use sysctl " Matteo Croce
2019-04-10 18:46   ` Kees Cook
2019-04-10 19:23     ` Matteo Croce
2019-04-10 21:50       ` Kees Cook
2019-04-10 22:30         ` Matteo Croce
2019-04-10 22:34           ` Kees Cook
2019-04-10 22:54             ` Matteo Croce
2019-04-10 22:59               ` Kees Cook
2019-04-16 23:45                 ` Andrew Morton
2019-04-17  3:21   ` Kees Cook
2019-04-17  3:22     ` Kees Cook [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGXu5jJBcWjVKePH9VhPvG9H9xL+iLimESBbQvFaNBiAvGpKww@mail.gmail.com \
    --to=keescook@chromium.org \
    --cc=adobriyan@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mcroce@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).