Re: [PATCH] usb-storage: Constify struct usb_device_id and us_unusual_dev
From: Alan Stern
Date: Sat Aug 24 2024 - 11:21:16 EST
On Sat, Aug 24, 2024 at 03:47:07PM +0200, 'Christophe JAILLET' via USB Mass Storage on Linux wrote:
> '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@xxxxxxxxxx>
> ---
> Compile tested-only.
>
> I hope that a single patch for all drivers in drivers/usb/storage/ is fine.
> ---
> drivers/usb/storage/alauda.c | 4 ++--
> drivers/usb/storage/cypress_atacb.c | 4 ++--
> drivers/usb/storage/datafab.c | 4 ++--
> drivers/usb/storage/ene_ub6250.c | 4 ++--
> drivers/usb/storage/freecom.c | 4 ++--
> drivers/usb/storage/isd200.c | 4 ++--
> drivers/usb/storage/jumpshot.c | 4 ++--
> drivers/usb/storage/karma.c | 4 ++--
> drivers/usb/storage/onetouch.c | 4 ++--
> drivers/usb/storage/sddr09.c | 4 ++--
> drivers/usb/storage/sddr55.c | 4 ++--
> drivers/usb/storage/shuttle_usbat.c | 4 ++--
> drivers/usb/storage/uas.c | 2 +-
> 13 files changed, 25 insertions(+), 25 deletions(-)
Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>