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

usb: storage: alauda: Use const for card ID array

The alauda_card_ids array is only read, and 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-3-09b417ded9c4@posteo.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jonathan Neuschäfer and committed by
Greg Kroah-Hartman
734b0a7a 13155c6b

+4 -4
+4 -4
drivers/usb/storage/alauda.c
··· 174 174 unsigned char zoneshift; /* 1<<zs blocks per zone */ 175 175 }; 176 176 177 - static struct alauda_card_info alauda_card_ids[] = { 177 + static const struct alauda_card_info alauda_card_ids[] = { 178 178 /* NAND flash */ 179 179 { 0x6e, 20, 8, 4, 8}, /* 1 MB */ 180 180 { 0xe8, 20, 8, 4, 8}, /* 1 MB */ ··· 200 200 { 0,} 201 201 }; 202 202 203 - static struct alauda_card_info *alauda_card_find_id(unsigned char id) 203 + static const struct alauda_card_info *alauda_card_find_id(unsigned char id) 204 204 { 205 205 int i; 206 206 ··· 383 383 { 384 384 unsigned char *data = us->iobuf; 385 385 int ready = 0; 386 - struct alauda_card_info *media_info; 386 + const struct alauda_card_info *media_info; 387 387 unsigned int num_zones; 388 388 389 389 while (ready == 0) { ··· 1132 1132 int rc; 1133 1133 struct alauda_info *info = (struct alauda_info *) us->extra; 1134 1134 unsigned char *ptr = us->iobuf; 1135 - static unsigned char inquiry_response[36] = { 1135 + static const unsigned char inquiry_response[36] = { 1136 1136 0x00, 0x80, 0x00, 0x01, 0x1F, 0x00, 0x00, 0x00 1137 1137 }; 1138 1138