Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F175306010
D60198.id188688.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
931 B
Referenced Files
None
Subscribers
None
D60198.id188688.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/uaccess.h b/sys/compat/linuxkpi/common/include/linux/uaccess.h
--- a/sys/compat/linuxkpi/common/include/linux/uaccess.h
+++ b/sys/compat/linuxkpi/common/include/linux/uaccess.h
@@ -32,6 +32,7 @@
#define _LINUXKPI_LINUX_UACCESS_H_
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/proc.h>
@@ -119,4 +120,20 @@
#define copy_from_user_inatomic_nontemporal(to, from, n) \
__copy_from_user_inatomic((to), (from), (n))
+static inline long
+strncpy_from_user(char *dst, const char __user *src, long count)
+{
+ size_t done;
+ int error;
+
+ if (count <= 0)
+ return (0);
+ error = copyinstr(src, dst, count, &done);
+ if (error == 0)
+ return ((long)done - 1); /* done includes the NUL */
+ if (error == ENAMETOOLONG)
+ return (count); /* truncated, as Linux */
+ return (-EFAULT);
+}
+
#endif /* _LINUXKPI_LINUX_UACCESS_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 10, 8:05 PM (9 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40282327
Default Alt Text
D60198.id188688.diff (931 B)
Attached To
Mode
D60198: linuxkpi: add strncpy_from_user()
Attached
Detach File
Event Timeline
Log In to Comment