q = (const void *)((const char *)p + len);
        if (unlikely(q > end || q < p))
                return ERR_PTR(-EFAULT);
-       dest->data = kmalloc(len, GFP_KERNEL);
+       dest->data = kmemdup(p, len, GFP_KERNEL);
        if (unlikely(dest->data == NULL))
                return ERR_PTR(-ENOMEM);
        dest->len = len;
-       memcpy(dest->data, p, len);
        return q;
 }
 
 
        q = (const void *)((const char *)p + len);
        if (unlikely(q > end || q < p))
                return ERR_PTR(-EFAULT);
-       res->data = kmalloc(len, GFP_KERNEL);
+       res->data = kmemdup(p, len, GFP_KERNEL);
        if (unlikely(res->data == NULL))
                return ERR_PTR(-ENOMEM);
-       memcpy(res->data, p, len);
        res->len = len;
        return q;
 }
 
        q = (const void *)((const char *)p + len);
        if (unlikely(q > end || q < p))
                return ERR_PTR(-EFAULT);
-       res->data = kmalloc(len, GFP_KERNEL);
+       res->data = kmemdup(p, len, GFP_KERNEL);
        if (unlikely(res->data == NULL))
                return ERR_PTR(-ENOMEM);
-       memcpy(res->data, p, len);
        return q;
 }
 
 
 static int dup_to_netobj(struct xdr_netobj *dst, char *src, int len)
 {
        dst->len = len;
-       dst->data = (len ? kmalloc(len, GFP_KERNEL) : NULL);
-       if (dst->data)
-               memcpy(dst->data, src, len);
+       dst->data = (len ? kmemdup(src, len, GFP_KERNEL) : NULL);
        if (len && !dst->data)
                return -ENOMEM;
        return 0;
        if (!new)
                goto out;
        kref_init(&new->h.ref);
-       new->h.name = kmalloc(strlen(name) + 1, GFP_KERNEL);
+       new->h.name = kstrdup(name, GFP_KERNEL);
        if (!new->h.name)
                goto out_free_dom;
-       strcpy(new->h.name, name);
        new->h.flavour = &svcauthops_gss;
        new->pseudoflavor = pseudoflavor;
 
 
 {
        struct rpc_clnt *new;
 
-       new = kmalloc(sizeof(*new), GFP_KERNEL);
+       new = kmemdup(clnt, sizeof(*new), GFP_KERNEL);
        if (!new)
                goto out_no_clnt;
-       memcpy(new, clnt, sizeof(*new));
        atomic_set(&new->cl_count, 1);
        atomic_set(&new->cl_users, 0);
        new->cl_parent = clnt;