]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ata: Constify struct pci_device_id
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 15 Nov 2024 21:08:55 +0000 (22:08 +0100)
committerNiklas Cassel <cassel@kernel.org>
Tue, 3 Dec 2024 04:10:20 +0000 (05:10 +0100)
'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>
drivers/ata/ata_generic.c
drivers/ata/pata_atp867x.c
drivers/ata/pata_piccolo.c

index 2f57ec00ab821684511a1c85fc5981aaf2c303fa..e70b6c089cf179845767485f165ad129cc219672 100644 (file)
@@ -209,7 +209,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id
        return ata_pci_bmdma_init_one(dev, ppi, &generic_sht, (void *)id, 0);
 }
 
-static struct pci_device_id ata_generic[] = {
+static const struct pci_device_id ata_generic[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE), },
        { PCI_DEVICE(PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_6565), },
        { PCI_DEVICE(PCI_VENDOR_ID_UMC,    PCI_DEVICE_ID_UMC_UM8673F), },
index aaef5924f6366d3278e4f1ff3d034c1117d109de..308f86f9e2f0f867bbbfb6021a5b0e6c007ca32e 100644 (file)
@@ -525,7 +525,7 @@ static int atp867x_reinit_one(struct pci_dev *pdev)
 }
 #endif
 
-static struct pci_device_id atp867x_pci_tbl[] = {
+static const struct pci_device_id atp867x_pci_tbl[] = {
        { PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867A),      0 },
        { PCI_VDEVICE(ARTOP, PCI_DEVICE_ID_ARTOP_ATP867B),      0 },
        { },
index ced906bf56be1926f58a1f49907303d75ab9572c..beb53bd990be46ed9d9545772d53e274cdbd8a2f 100644 (file)
@@ -97,7 +97,7 @@ static int ata_tosh_init_one(struct pci_dev *dev, const struct pci_device_id *id
        return ata_pci_bmdma_init_one(dev, ppi, &tosh_sht, NULL, 0);
 }
 
-static struct pci_device_id ata_tosh[] = {
+static const struct pci_device_id ata_tosh[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), },
        { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2),  },
        { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_3),  },