]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
uio: Constify struct pci_device_id
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tue, 19 Aug 2025 18:58:17 +0000 (20:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Sep 2025 13:57:04 +0000 (15:57 +0200)
'struct pci_device_id' is not modified in these drivers.

Constifying this structure moves some data to a read-only section, so
increases overall security.

On a x86_64, with allmodconfig, as an example:
Before:
======
   text    data     bss     dec     hex filename
   4073    1336       0    5409    1521 drivers/uio/uio_cif.o

After:
=====
   text    data     bss     dec     hex filename
   4233    1176       0    5409    1521 drivers/uio/uio_cif.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/114791f85f0f81531ca2169721eac4911dbe0865.1755629302.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/uio/uio_aec.c
drivers/uio/uio_cif.c
drivers/uio/uio_netx.c
drivers/uio/uio_sercos3.c

index 8c164e51ff9e1c1b8f32d4beb161cadf8b173039..dafcc5f44f24ed99527498b21032a6024eaf6ac3 100644 (file)
@@ -33,7 +33,7 @@
 
 #define MAILBOX                        0x0F
 
-static struct pci_device_id ids[] = {
+static const struct pci_device_id ids[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_AEC, PCI_DEVICE_ID_AEC_VITCLTC), },
        { 0, }
 };
index 1cc3b8b5a345ffc3c39ea8c7c9aff517b12e784c..4e4b589ddef1cb16a46939cf790d2eb9b3f60467 100644 (file)
@@ -105,7 +105,7 @@ static void hilscher_pci_remove(struct pci_dev *dev)
        iounmap(info->mem[0].internal_addr);
 }
 
-static struct pci_device_id hilscher_pci_ids[] = {
+static const struct pci_device_id hilscher_pci_ids[] = {
        {
                .vendor =       PCI_VENDOR_ID_PLX,
                .device =       PCI_DEVICE_ID_PLX_9030,
index a1a58802c793dd10b424aa0dd640693103011b8a..18917b2ac04ca9a64f05cea572654bef3d77f1e1 100644 (file)
@@ -127,7 +127,7 @@ static void netx_pci_remove(struct pci_dev *dev)
        iounmap(info->mem[0].internal_addr);
 }
 
-static struct pci_device_id netx_pci_ids[] = {
+static const struct pci_device_id netx_pci_ids[] = {
        {
                .vendor =       PCI_VENDOR_ID_HILSCHER,
                .device =       PCI_DEVICE_ID_HILSCHER_NETX,
index b93a5f8f4cba2e065925cc004c1d38fb3525756e..12afc2fa1a0bbd2a5bc57495f80eea0b2ceab337 100644 (file)
@@ -191,7 +191,7 @@ static void sercos3_pci_remove(struct pci_dev *dev)
        }
 }
 
-static struct pci_device_id sercos3_pci_ids[] = {
+static const struct pci_device_id sercos3_pci_ids[] = {
        {
                .vendor =       PCI_VENDOR_ID_PLX,
                .device =       PCI_DEVICE_ID_PLX_9030,