[PATCH] bcachefs: fix build on sh4

Kent Overstreet <[email protected]> Fri, 8 Aug 2025 23:19:44 -0400
Newsgroups org.kernel.vger.linux-bcachefs
Message-ID <[email protected]>
put_user() with a 64 bit value causes an ICE on sh4.

Reported-by: Alexander Viro <[email protected]>
Signed-off-by: Kent Overstreet <[email protected]>
---
 fs/bcachefs/sb-counters.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/bcachefs/sb-counters.c b/fs/bcachefs/sb-counters.c
index 2b4b8445d418..9fa2c568c985 100644
--- a/fs/bcachefs/sb-counters.c
+++ b/fs/bcachefs/sb-counters.c
@@ -136,7 +136,7 @@ long bch2_ioctl_query_counters(struct bch_fs *c,
 				? percpu_u64_get(&c->counters[i])
 				: c->counters_on_mount[i];
 
-			ret = put_user(v, &user_arg->d[stable]);
+			ret = copy_to_user_errcode(&user_arg->d[stable], &v, sizeof(v));
 			if (ret)
 				return ret;
 		}
-- 
2.50.1