aboutsummaryrefslogtreecommitdiffstats
path: root/mm/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/util.c')
-rw-r--r--mm/util.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/mm/util.c b/mm/util.c
index 7368479220b3..e14fa84ef39a 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -40,6 +40,24 @@ char *kstrdup(const char *s, gfp_t gfp)
40} 40}
41EXPORT_SYMBOL(kstrdup); 41EXPORT_SYMBOL(kstrdup);
42 42
43/**
44 * kmemdup - duplicate region of memory
45 *
46 * @src: memory region to duplicate
47 * @len: memory region length
48 * @gfp: GFP mask to use
49 */
50void *kmemdup(const void *src, size_t len, gfp_t gfp)
51{
52 void *p;
53
54 p = ____kmalloc(len, gfp);
55 if (p)
56 memcpy(p, src, len);
57 return p;
58}
59EXPORT_SYMBOL(kmemdup);
60
43/* 61/*
44 * strndup_user - duplicate an existing string from user space 62 * strndup_user - duplicate an existing string from user space
45 * 63 *