From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/3] btrfs-progs: fix dropped 'const' qualifiers exposed by the latest GCC (15.2.1)
Date: Mon, 23 Feb 2026 09:42:57 +1030 [thread overview]
Message-ID: <cover.1771801832.git.wqu@suse.com> (raw)
It looks lile the latest gcc has taken the 'const' qualifier checks one
step further, a char pointer that points into a string that has 'const'
qualifier should also has 'const'.
This will expose unexpected modification like the following:
void my_func(const char *options)
{
char *dot;
dot = strchr(options, '.');
if (!dot)
*dot = '\0';
}
In above example, @dot is either NULL or points to a location inside
@options. For the later case, since @dot itself is not const, we can
modify the content, resulting modification of the content of @options.
The latest GCC is able to detect such proxy modification and gives us
warning on them.
And in fact, btrfs-progs has exactly such proxied modification in
bconf_save_param(), fixed in the last patch by dropping the 'const'
quailifer.
Other than that, most are just false alerts and we can fix them by
adding a const quailifer.
Qu Wenruo (3):
btrfs-progs: enhance find_option()
btrfs-progs: constify the @dots variable inside parse_range_u64()
btrfs-progs: drop the 'const' qualifier from bconf_save_param()
common/parse-utils.c | 4 ++--
common/utils.c | 24 ++++++++++++++++++------
common/utils.h | 2 +-
3 files changed, 21 insertions(+), 9 deletions(-)
--
2.53.0
next reply other threads:[~2026-02-22 23:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-22 23:12 Qu Wenruo [this message]
2026-02-22 23:12 ` [PATCH 1/3] btrfs-progs: enhance find_option() Qu Wenruo
2026-03-17 16:39 ` David Sterba
2026-02-22 23:12 ` [PATCH 2/3] btrfs-progs: constify the @dots variable inside parse_range_u64() Qu Wenruo
2026-02-22 23:13 ` [PATCH 3/3] btrfs-progs: drop the 'const' qualifier from bconf_save_param() Qu Wenruo
2026-03-17 16:43 ` [PATCH 0/3] btrfs-progs: fix dropped 'const' qualifiers exposed by the latest GCC (15.2.1) David Sterba
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=cover.1771801832.git.wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@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