summaryrefslogtreecommitdiffstats
path: root/rust/helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'rust/helpers.c')
-rw-r--r--rust/helpers.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/rust/helpers.c b/rust/helpers.c
new file mode 100644
index 000000000000..1efb4776b9e8
--- /dev/null
+++ b/rust/helpers.c
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/bug.h>
+#include <linux/build_bug.h>
+#include <linux/uaccess.h>
+
+void rust_helper_BUG(void)
+{
+ BUG();
+}
+EXPORT_SYMBOL(rust_helper_BUG);
+
+int rust_helper_access_ok(const void __user *addr, unsigned long n)
+{
+ return access_ok(addr, n);
+}
+EXPORT_SYMBOL(rust_helper_access_ok);
+
+// See https://github.com/rust-lang/rust-bindgen/issues/1671
+static_assert(__builtin_types_compatible_p(size_t, uintptr_t),
+ "size_t must match uintptr_t, what architecture is this??");