From dbf0fa1c8d47914c3b4919f01b131e0523f6d804 Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sat, 24 Aug 2024 15:47:07 +0200 Subject: usb-storage: Constify struct usb_device_id and us_unusual_dev 'struct usb_device_id' and 'struct us_unusual_dev' are not modified in these drivers. Constifying these structures moves some data to a read-only section, so increase overall security, especially when the structure holds some function pointers (which is the case for struct us_unusual_dev). On a x86_64, with allmodconfig, as an example: Before: ====== text data bss dec hex filename 25249 4261 896 30406 76c6 drivers/usb/storage/alauda.o 3969 672 360 5001 1389 drivers/usb/storage/cypress_atacb.o After: ===== text data bss dec hex filename 25461 4041 896 30398 76be drivers/usb/storage/alauda.o 4225 400 360 4985 1379 drivers/usb/storage/cypress_atacb.o Signed-off-by: Christophe JAILLET Acked-by: Alan Stern Link: https://lore.kernel.org/r/b1b75a2a64b1f6cfad2a611f71393f281178fd3f.1724507157.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman --- drivers/usb/storage/alauda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/usb/storage/alauda.c') diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c index 40d34cc28344..a9d3c58ce7d9 100644 --- a/drivers/usb/storage/alauda.c +++ b/drivers/usb/storage/alauda.c @@ -132,7 +132,7 @@ static int init_alauda(struct us_data *us); { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ .driver_info = (flags) } -static struct usb_device_id alauda_usb_ids[] = { +static const struct usb_device_id alauda_usb_ids[] = { # include "unusual_alauda.h" { } /* Terminating entry */ }; @@ -154,7 +154,7 @@ MODULE_DEVICE_TABLE(usb, alauda_usb_ids); .initFunction = init_function, \ } -static struct us_unusual_dev alauda_unusual_dev_list[] = { +static const struct us_unusual_dev alauda_unusual_dev_list[] = { # include "unusual_alauda.h" { } /* Terminating entry */ }; -- cgit v1.2.3