linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	hch@lst.de, virtio-fs@redhat.com,
	v9fs-developer@lists.sourceforge.net, stefanha@redhat.com,
	miklos@szeredi.hu
Subject: Re: [PATCH v3 3/3] fs: simplify get_filesystem_list / get_all_fs_names
Date: Fri, 30 Jul 2021 00:57:07 +0000	[thread overview]
Message-ID: <YQNOY9H/6mJMWRNN@zeniv-ca.linux.org.uk> (raw)
In-Reply-To: <20210714202321.59729-4-vgoyal@redhat.com>

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?

  parent reply	other threads:[~2021-07-30  0:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 20:23 [PATCH v3 0/3] support booting of arbitrary non-blockdevice file systems Vivek Goyal
2021-07-14 20:23 ` [PATCH v3 1/3] init: split get_fs_names Vivek Goyal
2021-07-15 10:04   ` Stefan Hajnoczi
2021-07-14 20:23 ` [PATCH v3 2/3] init: allow mounting arbitrary non-blockdevice filesystems as root Vivek Goyal
2021-07-15 10:04   ` Stefan Hajnoczi
2021-07-14 20:23 ` [PATCH v3 3/3] fs: simplify get_filesystem_list / get_all_fs_names Vivek Goyal
2021-07-21 15:46   ` Stefan Hajnoczi
2021-07-30  0:57   ` Al Viro [this message]
2021-07-30 12:24     ` Vivek Goyal
2021-07-27 18:29 ` [PATCH v3 0/3] support booting of arbitrary non-blockdevice file systems Vivek Goyal
2021-07-29 15:08 ` Christian Brauner

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=YQNOY9H/6mJMWRNN@zeniv-ca.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=stefanha@redhat.com \
    --cc=v9fs-developer@lists.sourceforge.net \
    --cc=vgoyal@redhat.com \
    --cc=virtio-fs@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).