]> www.infradead.org Git - users/hch/block.git/commitdiff
xen/manage: Constify struct shutdown_handler
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 23 Jun 2024 09:26:50 +0000 (11:26 +0200)
committerJuergen Gross <jgross@suse.com>
Mon, 1 Jul 2024 06:47:53 +0000 (08:47 +0200)
'struct shutdown_handler' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increase overall security.

On a x86_64, with allmodconfig:
Before:
======
   text    data     bss     dec     hex filename
   7043     788       8    7839    1e9f drivers/xen/manage.o

After:
=====
   text    data     bss     dec     hex filename
   7164     676       8    7848    1ea8 drivers/xen/manage.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/ca1e75f66aed43191cf608de6593c7d6db9148f1.1719134768.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Juergen Gross <jgross@suse.com>
drivers/xen/manage.c

index c16df629907e13d4d4f3ace2ceaa5f8b669afc54..b4b4ebed68daf59dbdcea63556e9651d2e6ff24d 100644 (file)
@@ -208,7 +208,7 @@ static void do_reboot(void)
        orderly_reboot();
 }
 
-static struct shutdown_handler shutdown_handlers[] = {
+static const struct shutdown_handler shutdown_handlers[] = {
        { "poweroff",   true,   do_poweroff },
        { "halt",       false,  do_poweroff },
        { "reboot",     true,   do_reboot   },