Re: [PATCH] init/do_mounts.c: replace sys_mount() to do_mount()

From: Arnd Bergmann
Date: Tue Aug 17 2010 - 09:15:35 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/