aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/dm-ioctl.c14
-rw-r--r--drivers/parport/probe.c18
2 files changed, 8 insertions, 24 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index ee3c869d9701..200a0688f717 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -122,14 +122,6 @@ static struct hash_cell *__get_uuid_cell(const char *str)
122/*----------------------------------------------------------------- 122/*-----------------------------------------------------------------
123 * Inserting, removing and renaming a device. 123 * Inserting, removing and renaming a device.
124 *---------------------------------------------------------------*/ 124 *---------------------------------------------------------------*/
125static inline char *kstrdup(const char *str)
126{
127 char *r = kmalloc(strlen(str) + 1, GFP_KERNEL);
128 if (r)
129 strcpy(r, str);
130 return r;
131}
132
133static struct hash_cell *alloc_cell(const char *name, const char *uuid, 125static struct hash_cell *alloc_cell(const char *name, const char *uuid,
134 struct mapped_device *md) 126 struct mapped_device *md)
135{ 127{
@@ -139,7 +131,7 @@ static struct hash_cell *alloc_cell(const char *name, const char *uuid,
139 if (!hc) 131 if (!hc)
140 return NULL; 132 return NULL;
141 133
142 hc->name = kstrdup(name); 134 hc->name = kstrdup(name, GFP_KERNEL);
143 if (!hc->name) { 135 if (!hc->name) {
144 kfree(hc); 136 kfree(hc);
145 return NULL; 137 return NULL;
@@ -149,7 +141,7 @@ static struct hash_cell *alloc_cell(const char *name, const char *uuid,
149 hc->uuid = NULL; 141 hc->uuid = NULL;
150 142
151 else { 143 else {
152 hc->uuid = kstrdup(uuid); 144 hc->uuid = kstrdup(uuid, GFP_KERNEL);
153 if (!hc->uuid) { 145 if (!hc->uuid) {
154 kfree(hc->name); 146 kfree(hc->name);
155 kfree(hc); 147 kfree(hc);
@@ -273,7 +265,7 @@ static int dm_hash_rename(const char *old, const char *new)
273 /* 265 /*
274 * duplicate new. 266 * duplicate new.
275 */ 267 */
276 new_name = kstrdup(new); 268 new_name = kstrdup(new, GFP_KERNEL);
277 if (!new_name) 269 if (!new_name)
278 return -ENOMEM; 270 return -ENOMEM;
279 271
diff --git a/drivers/parport/probe.c b/drivers/parport/probe.c
index c94963145e17..6e6f42d01e64 100644
--- a/drivers/parport/probe.c
+++ b/drivers/parport/probe.c
@@ -48,14 +48,6 @@ static void pretty_print(struct parport *port, int device)
48 printk("\n"); 48 printk("\n");
49} 49}
50 50
51static char *strdup(char *str)
52{
53 int n = strlen(str)+1;
54 char *s = kmalloc(n, GFP_KERNEL);
55 if (!s) return NULL;
56 return strcpy(s, str);
57}
58
59static void parse_data(struct parport *port, int device, char *str) 51static void parse_data(struct parport *port, int device, char *str)
60{ 52{
61 char *txt = kmalloc(strlen(str)+1, GFP_KERNEL); 53 char *txt = kmalloc(strlen(str)+1, GFP_KERNEL);
@@ -88,16 +80,16 @@ static void parse_data(struct parport *port, int device, char *str)
88 if (!strcmp(p, "MFG") || !strcmp(p, "MANUFACTURER")) { 80 if (!strcmp(p, "MFG") || !strcmp(p, "MANUFACTURER")) {
89 if (info->mfr) 81 if (info->mfr)
90 kfree (info->mfr); 82 kfree (info->mfr);
91 info->mfr = strdup(sep); 83 info->mfr = kstrdup(sep, GFP_KERNEL);
92 } else if (!strcmp(p, "MDL") || !strcmp(p, "MODEL")) { 84 } else if (!strcmp(p, "MDL") || !strcmp(p, "MODEL")) {
93 if (info->model) 85 if (info->model)
94 kfree (info->model); 86 kfree (info->model);
95 info->model = strdup(sep); 87 info->model = kstrdup(sep, GFP_KERNEL);
96 } else if (!strcmp(p, "CLS") || !strcmp(p, "CLASS")) { 88 } else if (!strcmp(p, "CLS") || !strcmp(p, "CLASS")) {
97 int i; 89 int i;
98 if (info->class_name) 90 if (info->class_name)
99 kfree (info->class_name); 91 kfree (info->class_name);
100 info->class_name = strdup(sep); 92 info->class_name = kstrdup(sep, GFP_KERNEL);
101 for (u = sep; *u; u++) 93 for (u = sep; *u; u++)
102 *u = toupper(*u); 94 *u = toupper(*u);
103 for (i = 0; classes[i].token; i++) { 95 for (i = 0; classes[i].token; i++) {
@@ -112,7 +104,7 @@ static void parse_data(struct parport *port, int device, char *str)
112 !strcmp(p, "COMMAND SET")) { 104 !strcmp(p, "COMMAND SET")) {
113 if (info->cmdset) 105 if (info->cmdset)
114 kfree (info->cmdset); 106 kfree (info->cmdset);
115 info->cmdset = strdup(sep); 107 info->cmdset = kstrdup(sep, GFP_KERNEL);
116 /* if it speaks printer language, it's 108 /* if it speaks printer language, it's
117 probably a printer */ 109 probably a printer */
118 if (strstr(sep, "PJL") || strstr(sep, "PCL")) 110 if (strstr(sep, "PJL") || strstr(sep, "PCL"))
@@ -120,7 +112,7 @@ static void parse_data(struct parport *port, int device, char *str)
120 } else if (!strcmp(p, "DES") || !strcmp(p, "DESCRIPTION")) { 112 } else if (!strcmp(p, "DES") || !strcmp(p, "DESCRIPTION")) {
121 if (info->description) 113 if (info->description)
122 kfree (info->description); 114 kfree (info->description);
123 info->description = strdup(sep); 115 info->description = kstrdup(sep, GFP_KERNEL);
124 } 116 }
125 } 117 }
126 rock_on: 118 rock_on: