From: Andrew Morton <akpm@linux-foundation.org>
To: Ian Kent <raven@themaw.net>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
Siddhesh Poyarekar <siddhesh@gotplt.org>,
David Howells <dhowells@redhat.com>,
Miklos Szeredi <miklos@szeredi.hu>,
Carlos Maiolino <cmaiolino@redhat.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [REPOST PATCH v3 2/2] vfs: parse: deal with zero length string value
Date: Mon, 17 Oct 2022 18:55:23 -0700 [thread overview]
Message-ID: <20221017185523.22f43b5d7f9fee1e1e3d872f@linux-foundation.org> (raw)
In-Reply-To: <166365878918.39016.12757946948158123324.stgit@donald.themaw.net>
On Tue, 20 Sep 2022 15:26:29 +0800 Ian Kent <raven@themaw.net> wrote:
> Parsing an fs string that has zero length should result in the parameter
> being set to NULL so that downstream processing handles it correctly.
> For example, the proc mount table processing should print "(none)" in
> this case to preserve mount record field count, but if the value points
> to the NULL string this doesn't happen.
>
> ...
>
> --- a/fs/fs_parser.c
> +++ b/fs/fs_parser.c
> @@ -197,6 +197,8 @@ int fs_param_is_bool(struct p_log *log, const struct fs_parameter_spec *p,
> struct fs_parameter *param, struct fs_parse_result *result)
> {
> int b;
> + if (param->type == fs_value_is_empty)
> + return 0;
> if (param->type != fs_value_is_string)
> return fs_param_bad_value(log, param);
> if (!*param->string && (p->flags & fs_param_can_be_empty))
> @@ -213,6 +215,8 @@ int fs_param_is_u32(struct p_log *log, const struct fs_parameter_spec *p,
> struct fs_parameter *param, struct fs_parse_result *result)
> {
> int base = (unsigned long)p->data;
> + if (param->type == fs_value_is_empty)
> + return 0;
> if (param->type != fs_value_is_string)
> return fs_param_bad_value(log, param);
> if (!*param->string && (p->flags & fs_param_can_be_empty))
>
> [etcetera]
This feels wrong. Having to check for fs_value_is_empty in so many
places makes me think "we just shouldn't have got this far". Am I
right for once?
next prev parent reply other threads:[~2022-10-18 1:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 7:26 [REPOST PATCH v3 0/2] vfs: fix a mount table handling problem Ian Kent
2022-09-20 7:26 ` [REPOST PATCH v3 1/2] ext4: fix possible null pointer dereference Ian Kent
2022-09-20 7:26 ` [REPOST PATCH v3 2/2] vfs: parse: deal with zero length string value Ian Kent
2022-10-18 1:55 ` Andrew Morton [this message]
2022-10-18 2:07 ` Ian Kent
2022-09-21 1:20 ` [REPOST PATCH v3 0/2] vfs: fix a mount table handling problem Theodore Ts'o
2022-09-21 4:38 ` Ian Kent
2022-09-21 5:35 ` Ian Kent
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=20221017185523.22f43b5d7f9fee1e1e3d872f@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=cmaiolino@redhat.com \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=raven@themaw.net \
--cc=siddhesh@gotplt.org \
--cc=viro@ZenIV.linux.org.uk \
/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
all inboxes | Powered by JetHome®