From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 0/3] btrfs-progs: fix dropped 'const' qualifiers exposed by the latest GCC (15.2.1)
Date: Tue, 17 Mar 2026 17:43:17 +0100 [thread overview]
Message-ID: <20260317164317.GA5735@twin.jikos.cz> (raw)
In-Reply-To: <cover.1771801832.git.wqu@suse.com>
On Mon, Feb 23, 2026 at 09:42:57AM +1030, Qu Wenruo wrote:
> 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()
Added to devel, thanks.
prev parent reply other threads:[~2026-03-17 16:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-22 23:12 [PATCH 0/3] btrfs-progs: fix dropped 'const' qualifiers exposed by the latest GCC (15.2.1) Qu Wenruo
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 ` David Sterba [this message]
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=20260317164317.GA5735@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.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