mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
	akpm <akpm@linux-foundation.org>,
	Heming Zhao <heming.zhao@suse.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	ocfs2-devel@lists.linux.dev
Subject: Re: [PATCH] ocfs2: Constify struct configfs_item_operations and configfs_group_operations
Date: Mon, 15 Dec 2025 09:12:55 +0800	[thread overview]
Message-ID: <40943ae1-1856-4038-bd84-374f28504fad@linux.alibaba.com> (raw)
In-Reply-To: <7c7c00ba328e5e514d8debee698154039e9640dd.1765708880.git.christophe.jaillet@wanadoo.fr>



On 2025/12/14 18:41, 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
>   74011	  19312	   5280	  98603	  1812b	fs/ocfs2/cluster/heartbeat.o
> 
> After:
> =====
>    text	   data	    bss	    dec	    hex	filename
>   74171	  19152	   5280	  98603	  1812b	fs/ocfs2/cluster/heartbeat.o
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Looks fine.
Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>

> ---
> Compile tested only.
> 
> This change is possible since commits f2f36500a63b and f7f78098690d.
> ---
>  fs/ocfs2/cluster/heartbeat.c   | 4 ++--
>  fs/ocfs2/cluster/nodemanager.c | 8 ++++----
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
> index 724350925aff..8e9cbc334cf4 100644
> --- a/fs/ocfs2/cluster/heartbeat.c
> +++ b/fs/ocfs2/cluster/heartbeat.c
> @@ -1942,7 +1942,7 @@ static struct configfs_attribute *o2hb_region_attrs[] = {
>  	NULL,
>  };
>  
> -static struct configfs_item_operations o2hb_region_item_ops = {
> +static const struct configfs_item_operations o2hb_region_item_ops = {
>  	.release		= o2hb_region_release,
>  };
>  
> @@ -2193,7 +2193,7 @@ static struct configfs_attribute *o2hb_heartbeat_group_attrs[] = {
>  	NULL,
>  };
>  
> -static struct configfs_group_operations o2hb_heartbeat_group_group_ops = {
> +static const struct configfs_group_operations o2hb_heartbeat_group_group_ops = {
>  	.make_item	= o2hb_heartbeat_group_make_item,
>  	.drop_item	= o2hb_heartbeat_group_drop_item,
>  };
> diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
> index 6bc4e064ace4..c5e83c774d73 100644
> --- a/fs/ocfs2/cluster/nodemanager.c
> +++ b/fs/ocfs2/cluster/nodemanager.c
> @@ -396,7 +396,7 @@ static struct configfs_attribute *o2nm_node_attrs[] = {
>  	NULL,
>  };
>  
> -static struct configfs_item_operations o2nm_node_item_ops = {
> +static const struct configfs_item_operations o2nm_node_item_ops = {
>  	.release		= o2nm_node_release,
>  };
>  
> @@ -638,7 +638,7 @@ static void o2nm_node_group_drop_item(struct config_group *group,
>  	config_item_put(item);
>  }
>  
> -static struct configfs_group_operations o2nm_node_group_group_ops = {
> +static const struct configfs_group_operations o2nm_node_group_group_ops = {
>  	.make_item	= o2nm_node_group_make_item,
>  	.drop_item	= o2nm_node_group_drop_item,
>  };
> @@ -657,7 +657,7 @@ static void o2nm_cluster_release(struct config_item *item)
>  	kfree(cluster);
>  }
>  
> -static struct configfs_item_operations o2nm_cluster_item_ops = {
> +static const struct configfs_item_operations o2nm_cluster_item_ops = {
>  	.release	= o2nm_cluster_release,
>  };
>  
> @@ -741,7 +741,7 @@ static void o2nm_cluster_group_drop_item(struct config_group *group, struct conf
>  	config_item_put(item);
>  }
>  
> -static struct configfs_group_operations o2nm_cluster_group_group_ops = {
> +static const struct configfs_group_operations o2nm_cluster_group_group_ops = {
>  	.make_group	= o2nm_cluster_group_make_group,
>  	.drop_item	= o2nm_cluster_group_drop_item,
>  };


      reply	other threads:[~2025-12-15  1:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-14 10:41 Christophe JAILLET
2025-12-15  1:12 ` Joseph Qi [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=40943ae1-1856-4038-bd84-374f28504fad@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=heming.zhao@suse.com \
    --cc=jlbec@evilplan.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@lists.linux.dev \
    /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®