Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: storage: initializers: Use const for constant array

init_string is only read, not modified.

Declaring data as const makes it easier to see what's going on, and can
prevent unintended writes through placement in a read-only section.

Signed-off-by: Jonathan Neuschäfer <j.ne@posteo.net>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20250228-misc-const-v3-5-09b417ded9c4@posteo.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jonathan Neuschäfer and committed by
Greg Kroah-Hartman
b1a23e3b 6623c40b

+1 -1
+1 -1
drivers/usb/storage/initializers.c
··· 54 54 struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap*) us->iobuf; 55 55 int res; 56 56 unsigned int partial; 57 - static char init_string[] = "\xec\x0a\x06\x00$PCCHIPS"; 57 + static const char init_string[] = "\xec\x0a\x06\x00$PCCHIPS"; 58 58 59 59 usb_stor_dbg(us, "Sending UCR-61S2B initialization packet...\n"); 60 60