Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115923471
D34231.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
994 B
Referenced Files
None
Subscribers
None
D34231.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -509,6 +509,21 @@
return (kstrtobool(buf, res));
}
+static inline int
+kstrtoint_from_user(const char __user *s, size_t count, unsigned int base,
+ int *p)
+{
+ char buf[36] = {};
+
+ if (count > (sizeof(buf) - 1))
+ count = (sizeof(buf) - 1);
+
+ if (copy_from_user(buf, s, count))
+ return (-EFAULT);
+
+ return (kstrtoint(buf, base, p));
+}
+
static inline int
kstrtou8_from_user(const char __user *s, size_t count, unsigned int base,
u8 *p)
@@ -684,6 +699,9 @@
return (0);
}
+#define DECLARE_FLEX_ARRAY(_t, _n) \
+ struct { struct { } __dummy_ ## _n; _t _n[]; }
+
/*
* Checking if an option is defined would be easy if we could do CPP inside CPP.
* The defined case whether -Dxxx or -Dxxx=1 are easy to deal with. In either
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, May 1, 11:32 AM (17 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17880324
Default Alt Text
D34231.diff (994 B)
Attached To
Mode
D34231: LinuxKPI: add kstrtoint_from_user() and DECLARE_FLEX_ARRAY()
Attached
Detach File
Event Timeline
Log In to Comment