diff options
| author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2018-02-16 15:52:28 +0000 |
|---|---|---|
| committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2018-02-16 15:52:28 +0000 |
| commit | 10ee3d301671083e6baf3af23b995acbb31ec89e (patch) | |
| tree | 7cf9d5d4c0888dc22775bfb13db30c6b7750855c /sys/compat/linuxkpi/common/include/linux/string.h | |
| parent | f1f7e04a2999f45d4c1a22d4d59e5e1f1d80d284 (diff) | |
Notes
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux/string.h')
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/string.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h index a47eb4299ebe..918ff8169a38 100644 --- a/sys/compat/linuxkpi/common/include/linux/string.h +++ b/sys/compat/linuxkpi/common/include/linux/string.h @@ -71,6 +71,22 @@ memdup_user(const void *ptr, size_t len) } static inline void * +memdup_user_nul(const void *ptr, size_t len) +{ + char *retval; + int error; + + retval = malloc(len + 1, M_KMALLOC, M_WAITOK); + error = linux_copyin(ptr, retval, len); + if (error != 0) { + free(retval, M_KMALLOC); + return (ERR_PTR(error)); + } + retval[len] = '\0'; + return (retval); +} + +static inline void * kmemdup(const void *src, size_t len, gfp_t gfp) { void *dst; |
