All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Namhyung Kim <namhyung@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] init/do_mounts.c: replace sys_mount() to do_mount()
Date: Tue, 17 Aug 2010 15:15:26 +0200	[thread overview]
Message-ID: <201008171515.26175.arnd@arndb.de> (raw)
In-Reply-To: <1282048643-2475-1-git-send-email-namhyung@gmail.com>

On Tuesday 17 August 2010, Namhyung Kim wrote:
>  static int __init do_mount_root(char *name, char *fs, int flags, void *data)
>  {
> -       int err = sys_mount(name, "/root", fs, flags, data);
> +       int err;
> +       unsigned long data_page = 0;
> +
> +       if (data) {
> +               /* data should be in a page */
> +               data_page = __get_free_page(GFP_KERNEL);
> +               if (!data_page)
> +                       return -ENOMEM;
> +               strlcpy((char *) data_page, data, PAGE_SIZE);
> +       }
> +
> +       err = do_mount(name, "/root", fs, flags, (void *) data_page);
> +
> +       if (data_page)
> +               free_page(data_page);

AFAICT there is no need for the copy at all here. The reason that sys_mount
copies to a separate page is that it gets passed an arbitrary-length user
input.

	Arnd

  reply	other threads:[~2010-08-17 13:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-17 12:37 [PATCH] init/do_mounts.c: replace sys_mount() to do_mount() Namhyung Kim
2010-08-17 13:15 ` Arnd Bergmann [this message]
2010-08-17 13:25   ` Namhyung Kim
2010-08-17 13:41     ` Arnd Bergmann
2010-08-17 14:38       ` [PATCH v2] init: " Namhyung Kim

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=201008171515.26175.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.