From: Baoquan He <bhe@redhat.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: coxu@redhat.com, Andrew Morton <akpm@linux-foundation.org>,
Vivek Goyal <vgoyal@redhat.com>, Dave Young <dyoung@redhat.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
kexec@lists.infradead.org
Subject: Re: [PATCH] crash_dump: Constify struct configfs_item_operations and configfs_group_operations
Date: Mon, 15 Dec 2025 17:45:53 +0800 [thread overview]
Message-ID: <aT/Y0UjrIdij7f5X@MiWiFi-R3L-srv> (raw)
In-Reply-To: <b1c7b612-5c5e-4234-9aa5-a83105d01c52@wanadoo.fr>
On 12/15/25 at 08:19am, Christophe JAILLET wrote:
> Le 15/12/2025 à 03:13, Baoquan He a écrit :
> > On 12/14/25 at 06:57pm, Christophe JAILLET wrote:
> > > 'struct configfs_item_operations' and 'configfs_group_operations' are not
> > > modified in this driver.
> > >
> > > Constifying these structures moves some data to a read-only section, so
> > > increases overall security, especially when the structure holds some
> > > function pointers.
> > >
> > > On a x86_64, with allmodconfig, as an example:
> > > Before:
> > > ======
> > > text data bss dec hex filename
> > > 16339 11001 384 27724 6c4c kernel/crash_dump_dm_crypt.o
> > >
> > > After:
> > > =====
> > > text data bss dec hex filename
> > > 16499 10841 384 27724 6c4c kernel/crash_dump_dm_crypt.o
> > >
> > > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> >
> > Sounds not bad, leave this to Coiby to test.
> >
> > > ---
> > > Compile tested only.
> > >
> > > This change is possible since commits f2f36500a63b and f7f78098690d.
> >
> > I don't follow here, why do these two commits have anything with this
> > patch?
>
> Without these patches, it won't compile because "struct config_item_type"
> needs to be tweaked to accept some const field. It is what is done by these
> patches that have landed 2 weeks ago or so.
>
>
> Without these 2 commits, you would get (with French messages, sorry):
>
> CC kernel/crash_dump_dm_crypt.o
> kernel/crash_dump_dm_crypt.c:231:24: erreur: l'initialisation abandonne le
> qualificatif « const » du type pointé [-Werror=discarded-qualifiers]
> 231 | .ct_item_ops = &config_key_item_ops,
> | ^
> kernel/crash_dump_dm_crypt.c:306:25: erreur: l'initialisation abandonne le
> qualificatif « const » du type pointé [-Werror=discarded-qualifiers]
> 306 | .ct_group_ops = &config_keys_group_ops,
> | ^
Ah, I see now. Thanks for the information.
>
> >
> > > ---
> > > kernel/crash_dump_dm_crypt.c | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/kernel/crash_dump_dm_crypt.c b/kernel/crash_dump_dm_crypt.c
> > > index 401423ba477d..0d23dc1de67c 100644
> > > --- a/kernel/crash_dump_dm_crypt.c
> > > +++ b/kernel/crash_dump_dm_crypt.c
> > > @@ -223,7 +223,7 @@ static void config_key_release(struct config_item *item)
> > > key_count--;
> > > }
> > > -static struct configfs_item_operations config_key_item_ops = {
> > > +static const struct configfs_item_operations config_key_item_ops = {
> > > .release = config_key_release,
> > > };
> > > @@ -298,7 +298,7 @@ static struct configfs_attribute *config_keys_attrs[] = {
> > > * Note that, since no extra work is required on ->drop_item(),
> > > * no ->drop_item() is provided.
> > > */
> > > -static struct configfs_group_operations config_keys_group_ops = {
> > > +static const struct configfs_group_operations config_keys_group_ops = {
> > > .make_item = config_keys_make_item,
> > > };
> > > --
> > > 2.52.0
> > >
> > >
> >
> >
> >
>
next prev parent reply other threads:[~2025-12-15 9:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-14 17:57 [PATCH] crash_dump: Constify struct configfs_item_operations and configfs_group_operations Christophe JAILLET
2025-12-15 2:13 ` Baoquan He
2025-12-15 7:19 ` Christophe JAILLET
2025-12-15 9:45 ` Baoquan He [this message]
2025-12-23 3:56 ` Coiby Xu
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=aT/Y0UjrIdij7f5X@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=coxu@redhat.com \
--cc=dyoung@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vgoyal@redhat.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