[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YNCrnCvtlOuZO9jV@casper.infradead.org>
Date: Mon, 21 Jun 2021 16:09:16 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Christoph Hellwig <hch@....de>
Cc: viro@...iv.linux.org.uk, Vivek Goyal <vgoyal@...hat.com>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
virtio-fs@...hat.com
Subject: Re: [PATCH 1/2] init: split get_fs_names
On Mon, Jun 21, 2021 at 08:26:56AM +0200, Christoph Hellwig wrote:
> -static void __init get_fs_names(char *page)
> +static void __init split_fs_names(char *page, char *names)
If you're going to respin it anyway, can you rename 'page' to 'buf'
or something? Kind of confusing to have a char * called 'page'.
> {
> + strcpy(page, root_fs_names);
> + while (*page++) {
> + if (page[-1] == ',')
> + page[-1] = '\0';
> + }
> + *page = '\0';
> +}
is it really worth doing a strcpy() followed by a custom strtok()?
would this work better?
char c;
do {
c = *root_fs_names++;
*buf++ = c;
if (c == ',')
buf[-1] = '\0';
} while (c);
> +static void __init get_all_fs_names(char *page)
> +{
> + int len = get_filesystem_list(page);
it occurs to me that get_filesystem_list() fails silently. if you build
every linux filesystem in, and want your root on zonefs (assuming
they're alphabetical), we'll fail to find it without a message
indicating that we overflowed the buffer.
Powered by blists - more mailing lists