Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 37615
b: refs/heads/master
c: 1a2f67b
h: refs/heads/master
i:
  37613: 7814dee
  37611: d09fa25
  37607: fa78717
  37599: 1114d4a
v: v3
  • Loading branch information
Alexey Dobriyan authored and Linus Torvalds committed Oct 1, 2006
1 parent 4b13d3f commit 3c7fbdc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9442e691e4aec85eba43ac60a3e77c77fd2e73a4
refs/heads/master: 1a2f67b459bb7846d4a15924face63eb2683acc2
1 change: 1 addition & 0 deletions trunk/include/linux/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ extern void * memchr(const void *,int,__kernel_size_t);
#endif

extern char *kstrdup(const char *s, gfp_t gfp);
extern void *kmemdup(const void *src, size_t len, gfp_t gfp);

#ifdef __cplusplus
}
Expand Down
18 changes: 18 additions & 0 deletions trunk/mm/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ char *kstrdup(const char *s, gfp_t gfp)
}
EXPORT_SYMBOL(kstrdup);

/**
* kmemdup - duplicate region of memory
*
* @src: memory region to duplicate
* @len: memory region length
* @gfp: GFP mask to use
*/
void *kmemdup(const void *src, size_t len, gfp_t gfp)
{
void *p;

p = ____kmalloc(len, gfp);
if (p)
memcpy(p, src, len);
return p;
}
EXPORT_SYMBOL(kmemdup);

/*
* strndup_user - duplicate an existing string from user space
*
Expand Down

0 comments on commit 3c7fbdc

Please sign in to comment.