mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
LinuxKPI: add kvmemdup()
Add kvmemdup() as a variant of kmemdup(). While currently it could just call kmemdup() we duplicate the code and use kvmalloc() in case someone will change the implementation of kvmalloc/kvfree in slab.h. This is used by an updated wireless driver. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D45181
This commit is contained in:
parent
69b6c4a6ec
commit
8e4b8e9d80
1 changed files with 12 additions and 0 deletions
|
|
@ -98,6 +98,18 @@ kmemdup(const void *src, size_t len, gfp_t gfp)
|
|||
return (dst);
|
||||
}
|
||||
|
||||
/* See slab.h for kvmalloc/kvfree(). */
|
||||
static inline void *
|
||||
kvmemdup(const void *src, size_t len, gfp_t gfp)
|
||||
{
|
||||
void *dst;
|
||||
|
||||
dst = kvmalloc(len, gfp);
|
||||
if (dst != NULL)
|
||||
memcpy(dst, src, len);
|
||||
return (dst);
|
||||
}
|
||||
|
||||
static inline char *
|
||||
strndup_user(const char __user *ustr, long n)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue