This allows kmemdup_nul to be used in cases where the source pointer is not a char* or const char*, but the result should nevertheless have a nul char after the memcpy'ed data.
Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk> --- include/linux/string.h | 2 +- mm/util.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/string.h b/include/linux/string.h index 4a5a0eb7df51..b44a2254bc6b 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -169,7 +169,7 @@ extern char *kstrdup(const char *s, gfp_t gfp) __malloc; extern const char *kstrdup_const(const char *s, gfp_t gfp); extern char *kstrndup(const char *s, size_t len, gfp_t gfp); extern void *kmemdup(const void *src, size_t len, gfp_t gfp); -extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp); +extern void *kmemdup_nul(const void *s, size_t len, gfp_t gfp); extern char **argv_split(gfp_t gfp, const char *str, int *argcp); extern void argv_free(char **argv); diff --git a/mm/util.c b/mm/util.c index 9e3ebd2ef65f..15ef23f1176e 100644 --- a/mm/util.c +++ b/mm/util.c @@ -128,7 +128,7 @@ EXPORT_SYMBOL(kmemdup); * @len: The size of the data * @gfp: the GFP mask used in the kmalloc() call when allocating memory */ -char *kmemdup_nul(const char *s, size_t len, gfp_t gfp) +void *kmemdup_nul(const void *s, size_t len, gfp_t gfp) { char *buf; -- 2.16.4