]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
usb: storage: transport: Use const for constant array
authorJonathan Neuschäfer <j.ne@posteo.net>
Fri, 28 Feb 2025 15:11:17 +0000 (16:11 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 3 Mar 2025 09:24:41 +0000 (10:24 +0100)
This array 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-2-09b417ded9c4@posteo.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/transport.c

index e6bc8ecaecbb202714be69c6db6b0a4824de4855..1aa1bd26c81f2f9fbd508fdfed4465e6482bdef0 100644 (file)
@@ -528,7 +528,7 @@ static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb)
        u32 sector;
 
        /* To Report "Medium Error: Record Not Found */
-       static unsigned char record_not_found[18] = {
+       static const unsigned char record_not_found[18] = {
                [0]     = 0x70,                 /* current error */
                [2]     = MEDIUM_ERROR,         /* = 0x03 */
                [7]     = 0x0a,                 /* additional length */