aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include/linux/kernel.h
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2022-03-22 09:22:42 +0000
committerEmmanuel Vadot <manu@FreeBSD.org>2022-03-23 13:37:32 +0000
commit8e587a5f13ce676d7763ffa920148fe31bc3bfae (patch)
tree98c01f924f34d5b8717eeb416170c7cd968a1f3b /sys/compat/linuxkpi/common/include/linux/kernel.h
parent9b8016548ef61e2c42271c7dce35d0322540d2f1 (diff)
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux/kernel.h')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/kernel.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index d6916812f02a..8fb92dd2f93e 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -525,6 +525,21 @@ kstrtoint_from_user(const char __user *s, size_t count, unsigned int base,
}
static inline int
+kstrtouint_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 (kstrtouint(buf, base, p));
+}
+
+static inline int
kstrtou8_from_user(const char __user *s, size_t count, unsigned int base,
u8 *p)
{