[PATCH] IB: Fix a couple of MAD code paths
[powerpc.git] / drivers / md / dm-ioctl.c
index ee3c869..200a068 100644 (file)
@@ -122,14 +122,6 @@ static struct hash_cell *__get_uuid_cell(const char *str)
 /*-----------------------------------------------------------------
  * Inserting, removing and renaming a device.
  *---------------------------------------------------------------*/
-static inline char *kstrdup(const char *str)
-{
-       char *r = kmalloc(strlen(str) + 1, GFP_KERNEL);
-       if (r)
-               strcpy(r, str);
-       return r;
-}
-
 static struct hash_cell *alloc_cell(const char *name, const char *uuid,
                                    struct mapped_device *md)
 {
@@ -139,7 +131,7 @@ static struct hash_cell *alloc_cell(const char *name, const char *uuid,
        if (!hc)
                return NULL;
 
-       hc->name = kstrdup(name);
+       hc->name = kstrdup(name, GFP_KERNEL);
        if (!hc->name) {
                kfree(hc);
                return NULL;
@@ -149,7 +141,7 @@ static struct hash_cell *alloc_cell(const char *name, const char *uuid,
                hc->uuid = NULL;
 
        else {
-               hc->uuid = kstrdup(uuid);
+               hc->uuid = kstrdup(uuid, GFP_KERNEL);
                if (!hc->uuid) {
                        kfree(hc->name);
                        kfree(hc);
@@ -273,7 +265,7 @@ static int dm_hash_rename(const char *old, const char *new)
        /*
         * duplicate new.
         */
-       new_name = kstrdup(new);
+       new_name = kstrdup(new, GFP_KERNEL);
        if (!new_name)
                return -ENOMEM;