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
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D45181
(cherry picked from commit 8e4b8e9d80)
This commit is contained in:
parent
787b336361
commit
a87e584f6c
1 changed files with 12 additions and 0 deletions
|
|
@ -97,6 +97,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