[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YQNOY9H/6mJMWRNN@zeniv-ca.linux.org.uk>
Date: Fri, 30 Jul 2021 00:57:07 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Vivek Goyal <vgoyal@...hat.com>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
hch@....de, virtio-fs@...hat.com,
v9fs-developer@...ts.sourceforge.net, stefanha@...hat.com,
miklos@...redi.hu
Subject: Re: [PATCH v3 3/3] fs: simplify get_filesystem_list /
get_all_fs_names
On Wed, Jul 14, 2021 at 04:23:21PM -0400, Vivek Goyal wrote:
> +static int __init split_fs_names(char *page, char *names)
> {
> + int count = 0;
> + char *p = page;
>
> + strcpy(p, root_fs_names);
> + while (*p++) {
> + if (p[-1] == ',')
> + p[-1] = '\0';
> }
> + *p = '\0';
> +
> + for (p = page; *p; p += strlen(p)+1)
> + count++;
>
> + return count;
> }
Ummm.... The last part makes no sense - it counts '\0' in the array
pointed to be page, until the first double '\0' in there. All of
which had been put there by the loop immediately prior to that one...
Incidentally, it treats stray ,, in root_fs_names as termination;
is that intentional?
Powered by blists - more mailing lists