Page MenuHomeFreeBSD

D36350.id109839.diff
No OneTemporary

D36350.id109839.diff

diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h
--- a/sys/compat/linuxkpi/common/include/linux/string.h
+++ b/sys/compat/linuxkpi/common/include/linux/string.h
@@ -98,6 +98,26 @@
return (dst);
}
+static inline char *
+strndup_user(const char __user *ustr, long n)
+{
+ char *kstr;
+
+ if (ustr == NULL)
+ return (ERR_PTR(-EFAULT));
+
+ if (n < 1)
+ return (ERR_PTR(-EINVAL));
+
+ kstr = memdup_user(ustr, n);
+ if (IS_ERR(kstr))
+ return (kstr);
+
+ kstr[n-1] = '\0';
+
+ return (kstr);
+}
+
static inline char *
kstrdup(const char *string, gfp_t gfp)
{

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 23, 8:14 PM (12 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26030770
Default Alt Text
D36350.id109839.diff (633 B)

Event Timeline