]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: storage: initializers: Use const for constant array
authorJonathan Neuschäfer <j.ne@posteo.net>
Fri, 28 Feb 2025 15:11:20 +0000 (16:11 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 3 Mar 2025 09:24:41 +0000 (10:24 +0100)
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>
drivers/usb/storage/initializers.c

index f8f9ce8dc71029aff5ceaf4d62f596a30bbceca2..b243bd5521a66deb3ca3603b52ccf603e191a4de 100644 (file)
@@ -54,7 +54,7 @@ int usb_stor_ucr61s2b_init(struct us_data *us)
        struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap*) us->iobuf;
        int res;
        unsigned int partial;
-       static char init_string[] = "\xec\x0a\x06\x00$PCCHIPS";
+       static const char init_string[] = "\xec\x0a\x06\x00$PCCHIPS";
 
        usb_stor_dbg(us, "Sending UCR-61S2B initialization packet...\n");