* [PATCH] xen/usb: Constify struct hc_driver
@ 2025-10-26 10:51 Christophe JAILLET
2025-11-03 13:25 ` Jürgen Groß
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2025-10-26 10:51 UTC (permalink / raw)
To: Juergen Gross, Greg Kroah-Hartman
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, xen-devel,
linux-usb
'struct hc_driver' 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, as an example:
Before:
======
text data bss dec hex filename
52065 23176 256 75497 126e9 drivers/usb/host/xen-hcd.o
After:
=====
text data bss dec hex filename
52897 22344 256 75497 126e9 drivers/usb/host/xen-hcd.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/usb/host/xen-hcd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/xen-hcd.c b/drivers/usb/host/xen-hcd.c
index 1c2a95fe41e5..0a94d302911a 100644
--- a/drivers/usb/host/xen-hcd.c
+++ b/drivers/usb/host/xen-hcd.c
@@ -1388,7 +1388,7 @@ static int xenhcd_get_frame(struct usb_hcd *hcd)
return 0;
}
-static struct hc_driver xenhcd_usb20_hc_driver = {
+static const struct hc_driver xenhcd_usb20_hc_driver = {
.description = "xen-hcd",
.product_desc = "Xen USB2.0 Virtual Host Controller",
.hcd_priv_size = sizeof(struct xenhcd_info),
@@ -1413,7 +1413,7 @@ static struct hc_driver xenhcd_usb20_hc_driver = {
#endif
};
-static struct hc_driver xenhcd_usb11_hc_driver = {
+static const struct hc_driver xenhcd_usb11_hc_driver = {
.description = "xen-hcd",
.product_desc = "Xen USB1.1 Virtual Host Controller",
.hcd_priv_size = sizeof(struct xenhcd_info),
--
2.51.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] xen/usb: Constify struct hc_driver
2025-10-26 10:51 [PATCH] xen/usb: Constify struct hc_driver Christophe JAILLET
@ 2025-11-03 13:25 ` Jürgen Groß
0 siblings, 0 replies; 2+ messages in thread
From: Jürgen Groß @ 2025-11-03 13:25 UTC (permalink / raw)
To: Christophe JAILLET, Greg Kroah-Hartman
Cc: linux-kernel, kernel-janitors, xen-devel, linux-usb
[-- Attachment #1.1.1: Type: text/plain, Size: 751 bytes --]
On 26.10.25 11:51, Christophe JAILLET wrote:
> 'struct hc_driver' 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, as an example:
> Before:
> ======
> text data bss dec hex filename
> 52065 23176 256 75497 126e9 drivers/usb/host/xen-hcd.o
>
> After:
> =====
> text data bss dec hex filename
> 52897 22344 256 75497 126e9 drivers/usb/host/xen-hcd.o
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-03 13:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-26 10:51 [PATCH] xen/usb: Constify struct hc_driver Christophe JAILLET
2025-11-03 13:25 ` Jürgen Groß
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).