From: Ian Kent <raven@themaw.net>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: 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: [PATCH 1/2] vfs: parse: deal with zero length string value
Date: Mon, 25 Oct 2021 12:05:06 +0800 [thread overview]
Message-ID: <163513470696.40352.1069626993439788071.stgit@mickey.themaw.net> (raw)
From: Ian Kent <ikent@redhat.com>
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.
Signed-off-by: Ian Kent <ikent@redhat.com>
---
fs/fs_context.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/fs/fs_context.c b/fs/fs_context.c
index b7e43a780a62..a949cceccbfd 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -175,9 +175,13 @@ int vfs_parse_fs_string(struct fs_context *fc, const char *key,
};
if (value) {
- param.string = kmemdup_nul(value, v_size, GFP_KERNEL);
- if (!param.string)
- return -ENOMEM;
+ if (!v_size)
+ param.string = NULL;
+ else {
+ param.string = kmemdup_nul(value, v_size, GFP_KERNEL);
+ if (!param.string)
+ return -ENOMEM;
+ }
param.type = fs_value_is_string;
}
next reply other threads:[~2021-10-25 4:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-25 4:05 Ian Kent [this message]
2021-10-25 4:05 ` [PATCH 2/2] vfs: escape hash as well Ian Kent
2022-06-17 5:08 [PATCH 0/2] vfs: fix a couple of mount table handling problems Ian Kent
2022-06-17 5:09 ` [PATCH 1/2] vfs: parse: deal with zero length string value Ian Kent
2022-06-28 13:03 ` Christian Brauner
2022-06-28 0:30 [PATCH 0/2] vfs: fix a couple of mount table handling problems Ian Kent
2022-06-28 0:30 ` [PATCH 1/2] vfs: parse: deal with zero length string value Ian Kent
2022-06-28 17:55 ` Al Viro
2022-06-29 1:06 ` Ian Kent
2022-07-01 6:29 ` 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=163513470696.40352.1069626993439788071.stgit@mickey.themaw.net \
--to=raven@themaw.net \
--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=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®