[PATCH v2 1/3] rust: uaccess: use INLINE_COPY_TO_USER to guard copy_to_user()

From: Yury Norov

Date: Fri Apr 24 2026 - 22:09:21 EST


The copy_to_user() rust helper is only needed when the main kernel inlines
the function. It is controlled by INLINE_COPY_TO_USER, but the rust helper
is protected with INLINE_COPY_FROM_USER.

Fix that.

Reported-by: Christophe Leroy (CS GROUP) <chleroy@xxxxxxxxxx>
Closes: https://lore.kernel.org/all/746c9c50-20c4-4dc9-a539-bf1310ff9414@xxxxxxxxxx/
Fixes: d99dc586ca7c7 ("uaccess: decouple INLINE_COPY_FROM_USER and CONFIG_RUST")
Signed-off-by: Yury Norov <ynorov@xxxxxxxxxx>
---
rust/helpers/uaccess.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/rust/helpers/uaccess.c b/rust/helpers/uaccess.c
index d9625b9ee046..aff22f16ab38 100644
--- a/rust/helpers/uaccess.c
+++ b/rust/helpers/uaccess.c
@@ -20,7 +20,9 @@ unsigned long rust_helper__copy_from_user(void *to, const void __user *from, uns
{
return _inline_copy_from_user(to, from, n);
}
+#endif

+#ifdef INLINE_COPY_TO_USER
__rust_helper
unsigned long rust_helper__copy_to_user(void __user *to, const void *from, unsigned long n)
{
--
2.51.0