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

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>

authored by

Christophe JAILLET and committed by
Niklas Cassel
9986ce65 40384c84

+3 -3
+1 -1
drivers/ata/ata_generic.c
··· 209 209 return ata_pci_bmdma_init_one(dev, ppi, &generic_sht, (void *)id, 0); 210 210 } 211 211 212 - static struct pci_device_id ata_generic[] = { 212 + static const struct pci_device_id ata_generic[] = { 213 213 { PCI_DEVICE(PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE), }, 214 214 { PCI_DEVICE(PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_6565), }, 215 215 { PCI_DEVICE(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8673F), },
+1 -1
drivers/ata/pata_atp867x.c
··· 525 525 } 526 526 #endif 527 527 528 - static struct pci_device_id atp867x_pci_tbl[] = { 528 + static const struct pci_device_id atp867x_pci_tbl[] = { 529 529 { PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867A), 0 }, 530 530 { PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867B), 0 }, 531 531 { },
+1 -1
drivers/ata/pata_piccolo.c
··· 97 97 return ata_pci_bmdma_init_one(dev, ppi, &tosh_sht, NULL, 0); 98 98 } 99 99 100 - static struct pci_device_id ata_tosh[] = { 100 + static const struct pci_device_id ata_tosh[] = { 101 101 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), }, 102 102 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), }, 103 103 { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_3), },