diff options
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-ioctl.c | 14 |
1 files changed, 3 insertions, 11 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 | *---------------------------------------------------------------*/ |
125 | static 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 | |||
133 | static struct hash_cell *alloc_cell(const char *name, const char *uuid, | 125 | static 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 | ||