Skip to content

Commit dca4130

Browse files
committed
param: remove unnecessary writable charp
sysfs-writable charp arguments need to be locked against modification (since the old ones may be kfreed underneath us). String arguments are much simpler, so use them for small strings (eg. IFNAMSIZ). lkdtm only uses the parameters at module initialization time, so there's not much point making them writable. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Reviewed-by: Takashi Iwai <tiwai@suse.de> Tested-by: Phil Carmody <ext-phil.2.carmody@nokia.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: M. Mohan Kumar <mohan@in.ibm.com> Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Cc: Jeff Mahoney <jeffm@suse.com> Cc: Julia Lawall <julia@diku.dk> Cc: devel@driverdev.osuosl.org
1 parent 546970b commit dca4130

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

drivers/misc/lkdtm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ static int count = DEFAULT_COUNT;
124124
module_param(recur_count, int, 0644);
125125
MODULE_PARM_DESC(recur_count, " Recursion level for the stack overflow test, "\
126126
"default is 10");
127-
module_param(cpoint_name, charp, 0644);
127+
module_param(cpoint_name, charp, 0444);
128128
MODULE_PARM_DESC(cpoint_name, " Crash Point, where kernel is to be crashed");
129-
module_param(cpoint_type, charp, 0644);
129+
module_param(cpoint_type, charp, 0444);
130130
MODULE_PARM_DESC(cpoint_type, " Crash Point Type, action to be taken on "\
131131
"hitting the crash point");
132132
module_param(cpoint_count, int, 0644);

drivers/staging/rtl8187se/r8180_core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static struct pci_device_id rtl8180_pci_id_tbl[] __devinitdata = {
6161
};
6262

6363

64-
static char *ifname = "wlan%d";
64+
static char ifname[IFNAMSIZ] = "wlan%d";
6565
static int hwseqnum = 0;
6666
static int hwwep = 0;
6767
static int channels = 0x3fff;
@@ -72,7 +72,7 @@ MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
7272
MODULE_DESCRIPTION("Linux driver for Realtek RTL8180 / RTL8185 WiFi cards");
7373

7474

75-
module_param(ifname, charp, S_IRUGO|S_IWUSR);
75+
module_param_string(ifname, ifname, sizeof(ifname), S_IRUGO|S_IWUSR);
7676
module_param(hwseqnum, int, S_IRUGO|S_IWUSR);
7777
module_param(hwwep, int, S_IRUGO|S_IWUSR);
7878
module_param(channels, int, S_IRUGO|S_IWUSR);
@@ -3609,7 +3609,7 @@ static int __devinit rtl8180_pci_probe(struct pci_dev *pdev,
36093609

36103610
if (dev_alloc_name(dev, ifname) < 0) {
36113611
DMESG("Oops: devname already taken! Trying wlan%%d...\n");
3612-
ifname = "wlan%d";
3612+
strcpy(ifname, "wlan%d");
36133613
dev_alloc_name(dev, ifname);
36143614
}
36153615

drivers/staging/rtl8192e/r8192E_core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static const struct pci_device_id rtl8192_pci_id_tbl[] __devinitdata = {
112112
{}
113113
};
114114

115-
static char* ifname = "wlan%d";
115+
static char ifname[IFNAMSIZ] = "wlan%d";
116116
static int hwwep = 1; //default use hw. set 0 to use software security
117117
static int channels = 0x3fff;
118118

@@ -123,7 +123,7 @@ MODULE_DEVICE_TABLE(pci, rtl8192_pci_id_tbl);
123123
MODULE_DESCRIPTION("Linux driver for Realtek RTL819x WiFi cards");
124124

125125

126-
module_param(ifname, charp, S_IRUGO|S_IWUSR );
126+
module_param_string(ifname, ifname, sizeof(ifname), S_IRUGO|S_IWUSR);
127127
//module_param(hwseqnum,int, S_IRUGO|S_IWUSR);
128128
module_param(hwwep,int, S_IRUGO|S_IWUSR);
129129
module_param(channels,int, S_IRUGO|S_IWUSR);
@@ -6446,7 +6446,7 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
64466446

64476447
if (dev_alloc_name(dev, ifname) < 0){
64486448
RT_TRACE(COMP_INIT, "Oops: devname already taken! Trying wlan%%d...\n");
6449-
ifname = "wlan%d";
6449+
strcpy(ifname, "wlan%d");
64506450
dev_alloc_name(dev, ifname);
64516451
}
64526452

drivers/staging/rtl8192su/r8192U_core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ MODULE_VERSION("V 1.1");
144144
MODULE_DEVICE_TABLE(usb, rtl8192_usb_id_tbl);
145145
MODULE_DESCRIPTION("Linux driver for Realtek RTL8192 USB WiFi cards");
146146

147-
static char* ifname = "wlan%d";
147+
static char ifname[IFNAMSIZ] = "wlan%d";
148148
static int hwwep = 1; //default use hw. set 0 to use software security
149149
static int channels = 0x3fff;
150150

151151

152152

153-
module_param(ifname, charp, S_IRUGO|S_IWUSR );
153+
module_param_string(ifname, ifname, sizeof(ifname), S_IRUGO|S_IWUSR);
154154
//module_param(hwseqnum,int, S_IRUGO|S_IWUSR);
155155
module_param(hwwep,int, S_IRUGO|S_IWUSR);
156156
module_param(channels,int, S_IRUGO|S_IWUSR);
@@ -7406,7 +7406,7 @@ static int __devinit rtl8192_usb_probe(struct usb_interface *intf,
74067406

74077407
if (dev_alloc_name(dev, ifname) < 0){
74087408
RT_TRACE(COMP_INIT, "Oops: devname already taken! Trying wlan%%d...\n");
7409-
ifname = "wlan%d";
7409+
strcpy(ifname, "wlan%d");
74107410
dev_alloc_name(dev, ifname);
74117411
}
74127412

0 commit comments

Comments
 (0)