Linux 9p file system development
 help / color / mirror / Atom feed
* [PATCH net-next] net/9p/usbg: Constify struct configfs_item_operations
@ 2026-05-16  9:08 Christophe JAILLET
  2026-05-19 11:57 ` Dominique Martinet
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2026-05-16  9:08 UTC (permalink / raw)
  To: Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
	Christian Schoenebeck
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, v9fs

'struct configfs_item_operations' is not modified in this driver.

Constifying this structure 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:
Before:
======
   text	   data	    bss	    dec	    hex	filename
  25167	   9336	    256	  34759	   87c7	net/9p/trans_usbg.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  25231	   9272	    256	  34759	   87c7	net/9p/trans_usbg.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 net/9p/trans_usbg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/9p/trans_usbg.c b/net/9p/trans_usbg.c
index 1ce70338999c..419cda13a7b5 100644
--- a/net/9p/trans_usbg.c
+++ b/net/9p/trans_usbg.c
@@ -804,7 +804,7 @@ static void usb9pfs_attr_release(struct config_item *item)
 	usb_put_function_instance(&usb9pfs_opts->func_inst);
 }
 
-static struct configfs_item_operations usb9pfs_item_ops = {
+static const struct configfs_item_operations usb9pfs_item_ops = {
 	.release		= usb9pfs_attr_release,
 };
 
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net/9p/usbg: Constify struct configfs_item_operations
  2026-05-16  9:08 [PATCH net-next] net/9p/usbg: Constify struct configfs_item_operations Christophe JAILLET
@ 2026-05-19 11:57 ` Dominique Martinet
  0 siblings, 0 replies; 2+ messages in thread
From: Dominique Martinet @ 2026-05-19 11:57 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Eric Van Hensbergen, Latchesar Ionkov, Christian Schoenebeck,
	linux-kernel, kernel-janitors, v9fs

Christophe JAILLET wrote on Sat, May 16, 2026 at 11:08:28AM +0200:
> 'struct configfs_item_operations' is not modified in this driver.
> 
> Constifying this structure 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:
> Before:
> ======
>    text	   data	    bss	    dec	    hex	filename
>   25167	   9336	    256	  34759	   87c7	net/9p/trans_usbg.o
> 
> After:
> =====
>    text	   data	    bss	    dec	    hex	filename
>   25231	   9272	    256	  34759	   87c7	net/9p/trans_usbg.o
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Thanks, this makes sense -- I've picked it up in the 9p tree

-- 
Dominique

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-19 11:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-16  9:08 [PATCH net-next] net/9p/usbg: Constify struct configfs_item_operations Christophe JAILLET
2026-05-19 11:57 ` Dominique Martinet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox