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

index d5cdff30f6f31f98d3d58ffcdd2426d7cd385cbb..b323f0a3626031905b946ce64ddf04539a6e3232 100644 (file)
@@ -775,11 +775,11 @@ static void sddr55_card_info_destructor(void *extra) {
 static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
 {
        int result;
-       static unsigned char inquiry_response[8] = {
+       static const unsigned char inquiry_response[8] = {
                0x00, 0x80, 0x00, 0x02, 0x1F, 0x00, 0x00, 0x00
        };
        // write-protected for now, no block descriptor support
-       static unsigned char mode_page_01[20] = {
+       static const unsigned char mode_page_01[20] = {
                0x0, 0x12, 0x00, 0x80, 0x0, 0x0, 0x0, 0x0,
                0x01, 0x0A,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00