From: Rudi Heitbaum <rudi@heitbaum.com>
To: linux-nfs@vger.kernel.org
Cc: rudi@heitbaum.com
Subject: [PATCH 1/2] nfs-utils: mount.nfs: fix discards const from pointer target
Date: Sun, 15 Feb 2026 07:05:10 +0000 [thread overview]
Message-ID: <aZFwJmiqqLgWYSl6@1eac07209f0d> (raw)
dev is passed by nfs_parse_devname to nfs_parse_... as a copy of the
device name, the parser destructively modifies dev, so pass as non const
so that it can be modified without warning.
fixes:
parse_dev.c: In function 'nfs_parse_simple_hostname':
parse_dev.c:89:15: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
89 | colon = strchr(dev, ':');
| ^
parse_dev.c:100:15: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
100 | comma = strchr(dev, ',');
| ^
parse_dev.c: In function 'nfs_parse_square_bracket':
parse_dev.c:146:16: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
146 | cbrace = strchr(dev, ']');
| ^
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
---
utils/mount/parse_dev.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/utils/mount/parse_dev.c b/utils/mount/parse_dev.c
index 2ade5d5d..a6354bba 100644
--- a/utils/mount/parse_dev.c
+++ b/utils/mount/parse_dev.c
@@ -79,7 +79,7 @@ static int nfs_pdn_missing_brace_err(void)
/*
* Standard hostname:path format
*/
-static int nfs_parse_simple_hostname(const char *dev,
+static int nfs_parse_simple_hostname(char *dev,
char **hostname, char **pathname)
{
size_t host_len, path_len;
@@ -134,7 +134,7 @@ static int nfs_parse_simple_hostname(const char *dev,
* There could be anything in between the brackets, but we'll
* let DNS resolution sort it out later.
*/
-static int nfs_parse_square_bracket(const char *dev,
+static int nfs_parse_square_bracket(char *dev,
char **hostname, char **pathname)
{
size_t host_len, path_len;
@@ -185,7 +185,7 @@ static int nfs_parse_square_bracket(const char *dev,
* with the mount request and failing with a cryptic error message
* later.
*/
-static int nfs_parse_nfs_url(__attribute__((unused)) const char *dev,
+static int nfs_parse_nfs_url(__attribute__((unused)) char *dev,
__attribute__((unused)) char **hostname,
__attribute__((unused)) char **pathname)
{
--
2.51.0
next reply other threads:[~2026-02-15 7:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-15 7:05 Rudi Heitbaum [this message]
2026-02-24 12:52 ` [PATCH 1/2] nfs-utils: mount.nfs: fix discards const from pointer target Steve Dickson
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=aZFwJmiqqLgWYSl6@1eac07209f0d \
--to=rudi@heitbaum.com \
--cc=linux-nfs@vger.kernel.org \
/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