linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Eric Sandeen <sandeen@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	fsdevel <linux-fsdevel@vger.kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	Luis Chamberlain <mcgrof@kernel.org>
Subject: Re: [PATCH] sysctl: add proc_do_large_bitmap test node
Date: Thu, 21 Feb 2019 10:40:18 -0800	[thread overview]
Message-ID: <CAGXu5j+m8TBnBZYUAAeS-e8d-ZtPWZ+KFw=ibGAekHs9JT57nA@mail.gmail.com> (raw)
In-Reply-To: <8166cf23-db52-7679-3378-8523889a9cd0@sandeen.net>

On Thu, Feb 21, 2019 at 9:45 AM Eric Sandeen <sandeen@sandeen.net> wrote:
>
> Add a test node for proc_do_large_bitmap to the test_sysctl.c
> infrastructure.  It's sized the same as the one existing user.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>
> diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c
> index 3dd801c1c85b..1263be4ebfaf 100644
> --- a/lib/test_sysctl.c
> +++ b/lib/test_sysctl.c
> @@ -47,6 +47,9 @@ struct test_sysctl_data {
>         unsigned int uint_0001;
>
>         char string_0001[65];
> +
> +#define SYSCTL_TEST_BITMAP_SIZE        65536
> +       unsigned long *bitmap_0001;
>  };
>
>  static struct test_sysctl_data test_data = {
> @@ -102,6 +106,13 @@ static struct ctl_table test_table[] = {
>                 .mode           = 0644,
>                 .proc_handler   = proc_dostring,
>         },
> +       {
> +               .procname       = "bitmap_0001",
> +               .data           = &test_data.bitmap_0001,
> +               .maxlen         = SYSCTL_TEST_BITMAP_SIZE,
> +               .mode           = 0644,
> +               .proc_handler   = proc_do_large_bitmap,
> +       },
>         { }
>  };
>
> @@ -129,15 +140,21 @@ static struct ctl_table_header *test_sysctl_header;
>
>  static int __init test_sysctl_init(void)
>  {
> +       test_data.bitmap_0001 = kzalloc(SYSCTL_TEST_BITMAP_SIZE/8, GFP_KERNEL);
> +       if (!test_data.bitmap_0001)
> +               return -ENOMEM;
>         test_sysctl_header = register_sysctl_table(test_sysctl_root_table);
> -       if (!test_sysctl_header)
> +       if (!test_sysctl_header) {
> +               kfree(test_data.bitmap_0001);
>                 return -ENOMEM;
> +       }
>         return 0;
>  }
>  late_initcall(test_sysctl_init);
>
>  static void __exit test_sysctl_exit(void)
>  {
> +       kfree(test_data.bitmap_0001);
>         if (test_sysctl_header)
>                 unregister_sysctl_table(test_sysctl_header);
>  }
>


-- 
Kees Cook

  reply	other threads:[~2019-02-21 18:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20 23:32 [PATCH] sysctl: Fix proc_do_large_bitmap for large input buffers Eric Sandeen
2019-02-20 23:35 ` Eric Sandeen
2019-02-21 15:18   ` Luis Chamberlain
2019-02-21 17:47     ` Eric Sandeen
2019-02-21 17:52       ` Luis Chamberlain
2019-02-21 17:59         ` Eric Sandeen
2019-02-21 17:45 ` [PATCH] sysctl: add proc_do_large_bitmap test node Eric Sandeen
2019-02-21 18:40   ` Kees Cook [this message]
2019-02-21 18:43   ` [PATCH] test_sysctl: add proc_do_large_bitmap test function Eric Sandeen
2019-02-21 19:01     ` Eric Sandeen
2019-02-21 19:16     ` [PATCH V2] " Eric Sandeen
2019-03-05  4:43 ` [PATCH] sysctl: Fix proc_do_large_bitmap for large input buffers Eric Sandeen
2019-03-19 15:30   ` Luis Chamberlain
2019-03-19 15:57     ` Luis Chamberlain

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='CAGXu5j+m8TBnBZYUAAeS-e8d-ZtPWZ+KFw=ibGAekHs9JT57nA@mail.gmail.com' \
    --to=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=sandeen@sandeen.net \
    /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).