Skip to contentSkip to conversation

staging: rtl8192e: Constify struct pci_device_id

PATCH In review Riyan Dhiman 2 participants 2 messages Aug 31, 2024 – Sep 2, 2024 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8192e: Constify struct pci_device_id

static variable struct pci_device_id rtl8192_pci_id_tbl is not modified in file rtl_core.c.

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

Before
======
text data bss dec hex filename
17838 893 1 18732 492c drivers/staging/rtl8192e/rtl8192e/rtl_core.o

After
=====
text data bss dec hex filename
18006 725 1 18732 492c drivers/staging/rtl8192e/rtl8192e/rtl_core.o

---
Compile tested only
--

 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +1 -1
index ad21263e725f..22a203d01b8a 100644
@@ -25,7 +25,7 @@
 int hwwep = 1;
 static char *ifname = "wlan%d";
 
-static struct pci_device_id rtl8192_pci_id_tbl[] = {
+static const struct pci_device_id rtl8192_pci_id_tbl[] = {
 	{PCI_DEVICE(0x10ec, 0x8192)},
 	{PCI_DEVICE(0x07aa, 0x0044)},
 	{PCI_DEVICE(0x07aa, 0x0047)},
Signature · 1 line
2.46.0
Tested-by on v1 1/1
#1 lore raw
Quoted 28 lines · Riyan Dhiman

static variable struct pci_device_id rtl8192_pci_id_tbl is not modified in file rtl_core.c.

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

Before
======
text data bss dec hex filename
17838 893 1 18732 492c drivers/staging/rtl8192e/rtl8192e/rtl_core.o

After
=====
text data bss dec hex filename
18006 725 1 18732 492c drivers/staging/rtl8192e/rtl8192e/rtl_core.o

---
Compile tested only
--

  drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -0
index ad21263e725f..22a203d01b8a 100644

drivers/staging/rtl8192e/rtl8192e/rtl_core.c line 31

Quoted 8 lines
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +1 -1
@@ -25,7 +25,7 @@
  int hwwep = 1;
  static char *ifname = "wlan%d";
 
-static struct pci_device_id rtl8192_pci_id_tbl[] = {
+static const struct pci_device_id rtl8192_pci_id_tbl[] = {
  	{PCI_DEVICE(0x10ec, 0x8192)},
  	{PCI_DEVICE(0x07aa, 0x0044)},
  	{PCI_DEVICE(0x07aa, 0x0047)},