Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F137367245
D36350.id109839.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
633 B
Referenced Files
None
Subscribers
None
D36350.id109839.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D36350: Add strndup_user() to LinuxKPI <linux/string.h>
Attached
Detach File
Event Timeline
Log In to Comment