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

usb: storage: transport: Use const for constant array

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>

authored by

Jonathan Neuschäfer and committed by
Greg Kroah-Hartman
13155c6b 7a4dc560

+1 -1
+1 -1
drivers/usb/storage/transport.c
··· 528 528 u32 sector; 529 529 530 530 /* To Report "Medium Error: Record Not Found */ 531 - static unsigned char record_not_found[18] = { 531 + static const unsigned char record_not_found[18] = { 532 532 [0] = 0x70, /* current error */ 533 533 [2] = MEDIUM_ERROR, /* = 0x03 */ 534 534 [7] = 0x0a, /* additional length */