]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/9p/usbg: Constify struct configfs_item_operations
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 16 May 2026 09:08:28 +0000 (11:08 +0200)
committerDominique Martinet <asmadeus@codewreck.org>
Tue, 19 May 2026 11:55:53 +0000 (11:55 +0000)
'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>
Message-ID: <2478bdabd7d169a686879c049f11dc307b5debbd.1778922467.git.christophe.jaillet@wanadoo.fr>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
net/9p/trans_usbg.c

index 1ce70338999c8c712ba298efa88c69e6372ac40f..419cda13a7b568893db47add8a4091067208f3bd 100644 (file)
@@ -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,
 };