linuxkpi: Add strndup_user
Reviewed by: hselasky, markj Differential Revision: https://reviews.freebsd.org/D36350 Sponsored by: Google, Inc. (GSoC 2022)
This commit is contained in:
parent
a06eeeaa1d
commit
a11195df34
@ -98,6 +98,15 @@ kmemdup(const void *src, size_t len, gfp_t gfp)
|
||||
return (dst);
|
||||
}
|
||||
|
||||
static inline char *
|
||||
strndup_user(const char __user *ustr, long n)
|
||||
{
|
||||
if (n < 1)
|
||||
return (ERR_PTR(-EINVAL));
|
||||
|
||||
return (memdup_user_nul(ustr, n - 1));
|
||||
}
|
||||
|
||||
static inline char *
|
||||
kstrdup(const char *string, gfp_t gfp)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user