Skip to content

Commit c9a71ca

Browse files
tititiou36martinkpetersen
authored andcommitted
scsi: Constify struct pci_device_id
'struct pci_device_id' is not modified in these drivers. Constifying this structure moves some data to a read-only section, so increase overall security. On a x86_64, with allmodconfig, as an example: Before: ====== text data bss dec hex filename 70237 9137 320 79694 1374e drivers/scsi/3w-9xxx.o After: ===== text data bss dec hex filename 70461 8913 320 79694 1374e drivers/scsi/3w-9xxx.o Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/fc61b1946488c1ea8f7a17a06cf40fbd05dcc6de.1733590049.git.christophe.jaillet@wanadoo.fr Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 6cb7063 commit c9a71ca

32 files changed

+32
-32
lines changed

drivers/scsi/3w-9xxx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2261,7 +2261,7 @@ static int __maybe_unused twa_resume(struct device *dev)
22612261
} /* End twa_resume() */
22622262

22632263
/* PCI Devices supported by this driver */
2264-
static struct pci_device_id twa_pci_tbl[] = {
2264+
static const struct pci_device_id twa_pci_tbl[] = {
22652265
{ PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9000,
22662266
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
22672267
{ PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9550SX,

drivers/scsi/3w-sas.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,7 @@ static int __maybe_unused twl_resume(struct device *dev)
18221822
} /* End twl_resume() */
18231823

18241824
/* PCI Devices supported by this driver */
1825-
static struct pci_device_id twl_pci_tbl[] = {
1825+
static const struct pci_device_id twl_pci_tbl[] = {
18261826
{ PCI_VDEVICE(3WARE, PCI_DEVICE_ID_3WARE_9750) },
18271827
{ }
18281828
};

drivers/scsi/3w-xxxx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2393,7 +2393,7 @@ static void tw_remove(struct pci_dev *pdev)
23932393
} /* End tw_remove() */
23942394

23952395
/* PCI Devices supported by this driver */
2396-
static struct pci_device_id tw_pci_tbl[] = {
2396+
static const struct pci_device_id tw_pci_tbl[] = {
23972397
{ PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_1000,
23982398
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
23992399
{ PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_7000,

drivers/scsi/BusLogic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3716,7 +3716,7 @@ static void __exit blogic_exit(void)
37163716
__setup("BusLogic=", blogic_setup);
37173717

37183718
#ifdef MODULE
3719-
/*static struct pci_device_id blogic_pci_tbl[] = {
3719+
/*static const struct pci_device_id blogic_pci_tbl[] = {
37203720
{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
37213721
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
37223722
{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC,

drivers/scsi/a100u2w.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ static void inia100_remove_one(struct pci_dev *pdev)
12061206
scsi_host_put(shost);
12071207
}
12081208

1209-
static struct pci_device_id inia100_pci_tbl[] = {
1209+
static const struct pci_device_id inia100_pci_tbl[] = {
12101210
{PCI_VENDOR_ID_INIT, 0x1060, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
12111211
{0,}
12121212
};

drivers/scsi/advansys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11409,7 +11409,7 @@ static struct eisa_driver advansys_eisa_driver = {
1140911409
};
1141011410

1141111411
/* PCI Devices supported by this driver */
11412-
static struct pci_device_id advansys_pci_tbl[] = {
11412+
static const struct pci_device_id advansys_pci_tbl[] = {
1141311413
{PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_1200A,
1141411414
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
1141511415
{PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940,

drivers/scsi/am53c974.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ static void pci_esp_remove_one(struct pci_dev *pdev)
513513
scsi_host_put(esp->host);
514514
}
515515

516-
static struct pci_device_id am53c974_pci_tbl[] = {
516+
static const struct pci_device_id am53c974_pci_tbl[] = {
517517
{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_SCSI,
518518
PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
519519
{ }

drivers/scsi/arcmsr/arcmsr_hba.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static const struct scsi_host_template arcmsr_scsi_host_template = {
172172
.no_write_same = 1,
173173
};
174174

175-
static struct pci_device_id arcmsr_device_id_table[] = {
175+
static const struct pci_device_id arcmsr_device_id_table[] = {
176176
{PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1110),
177177
.driver_data = ACB_ADAPTER_TYPE_A},
178178
{PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1120),

drivers/scsi/atp870u.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1743,7 +1743,7 @@ static const struct scsi_host_template atp870u_template = {
17431743
.max_sectors = ATP870U_MAX_SECTORS,
17441744
};
17451745

1746-
static struct pci_device_id atp870u_id_table[] = {
1746+
static const struct pci_device_id atp870u_id_table[] = {
17471747
{ PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP885_DEVID) },
17481748
{ PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP880_DEVID1) },
17491749
{ PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP880_DEVID2) },

drivers/scsi/cxlflash/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3177,7 +3177,7 @@ static struct dev_dependent_vals dev_briard_vals = { CXLFLASH_MAX_SECTORS,
31773177
/*
31783178
* PCI device binding table
31793179
*/
3180-
static struct pci_device_id cxlflash_pci_table[] = {
3180+
static const struct pci_device_id cxlflash_pci_table[] = {
31813181
{PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CORSA,
31823182
PCI_ANY_ID, PCI_ANY_ID, 0, 0, (kernel_ulong_t)&dev_corsa_vals},
31833183
{PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_FLASH_GT,

0 commit comments

Comments
 (0)