Author: hselasky Date: Sun Feb 25 10:18:49 2018 New Revision: 329954 URL: https://svnweb.freebsd.org/changeset/base/329954
Log: MFC r329377: Implement memdup_user_nul() in the LinuxKPI. Submitted by: Johannes Lundberg <johal...@gmail.com> Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/string.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/string.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/string.h Sun Feb 25 10:18:02 2018 (r329953) +++ stable/11/sys/compat/linuxkpi/common/include/linux/string.h Sun Feb 25 10:18:49 2018 (r329954) @@ -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; _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"