Skip to content

Commit 9986ce6

Browse files
tititiou36floatious
authored andcommitted
ata: 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 4245 1454 4 5703 1647 drivers/ata/ata_generic.o After: ===== text data bss dec hex filename 4725 974 4 5703 1647 drivers/ata/ata_generic.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Niklas Cassel <cassel@kernel.org> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> Link: https://lore.kernel.org/r/8bddfee7f6f0f90eeb6da7156e30ab3bd553deb1.1731704917.git.christophe.jaillet@wanadoo.fr Signed-off-by: Niklas Cassel <cassel@kernel.org>
1 parent 40384c8 commit 9986ce6

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

drivers/ata/ata_generic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id
209209
return ata_pci_bmdma_init_one(dev, ppi, &generic_sht, (void *)id, 0);
210210
}
211211

212-
static struct pci_device_id ata_generic[] = {
212+
static const struct pci_device_id ata_generic[] = {
213213
{ PCI_DEVICE(PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE), },
214214
{ PCI_DEVICE(PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_6565), },
215215
{ PCI_DEVICE(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8673F), },

drivers/ata/pata_atp867x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ static int atp867x_reinit_one(struct pci_dev *pdev)
525525
}
526526
#endif
527527

528-
static struct pci_device_id atp867x_pci_tbl[] = {
528+
static const struct pci_device_id atp867x_pci_tbl[] = {
529529
{ PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867A), 0 },
530530
{ PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867B), 0 },
531531
{ },

drivers/ata/pata_piccolo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static int ata_tosh_init_one(struct pci_dev *dev, const struct pci_device_id *id
9797
return ata_pci_bmdma_init_one(dev, ppi, &tosh_sht, NULL, 0);
9898
}
9999

100-
static struct pci_device_id ata_tosh[] = {
100+
static const struct pci_device_id ata_tosh[] = {
101101
{ PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), },
102102
{ PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), },
103103
{ PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_3), },

0 commit comments

Comments
 (0)