lkml.org 
[lkml]   [2021]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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?

\
 
 \ /
  Last update: 2021-07-30 02:58    [W:0.110 / U:0.860 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site