usb-storage: Constify struct usb_device_id and us_unusual_dev
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 24 Aug 2024 13:47:07 +0000 (15:47 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Sep 2024 07:49:40 +0000 (09:49 +0200)
commitdbf0fa1c8d47914c3b4919f01b131e0523f6d804
tree14eb899bd62525f06e3b473d4e1c092a9f0da83e
parente4fdcc10092fb244218013bfe8ff01c55d54e8e4
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 <christophe.jaillet@wanadoo.fr>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/b1b75a2a64b1f6cfad2a611f71393f281178fd3f.1724507157.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 files changed:
drivers/usb/storage/alauda.c
drivers/usb/storage/cypress_atacb.c
drivers/usb/storage/datafab.c
drivers/usb/storage/ene_ub6250.c
drivers/usb/storage/freecom.c
drivers/usb/storage/isd200.c
drivers/usb/storage/jumpshot.c
drivers/usb/storage/karma.c
drivers/usb/storage/onetouch.c
drivers/usb/storage/sddr09.c
drivers/usb/storage/sddr55.c
drivers/usb/storage/shuttle_usbat.c
drivers/usb/storage/uas.c