Skip to contentSkip to conversation

bcachefs: fix build on sh4

PATCH In review Kent Overstreet 2 participants 2 messages Aug 9, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcachefs: fix build on sh4

put_user() with a 64 bit value causes an ICE on sh4.

---
 fs/bcachefs/sb-counters.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/bcachefs/sb-counters.c +1 -1
index 2b4b8445d418..9fa2c568c985 100644
@@ -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;
 		}
Signature · 1 line
2.50.1
#1 lore raw
Quoted 13 lines · Kent Overstreet

put_user() with a 64 bit value causes an ICE on sh4.

---
 fs/bcachefs/sb-counters.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/bcachefs/sb-counters.c +0 -0
index 2b4b8445d418..9fa2c568c985 100644

fs/bcachefs/sb-counters.c long bch2_ioctl_query_counters(struct bch_fs *c, · line 142

Quoted 8 lines
fs/bcachefs/sb-counters.c +1 -1
@@ -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;
 		}

If anything, that's the wrong place - put_user() on 64bit *is* allowed, whatever the architecture. See __put_user_u64() in arch/sh/include/asm/uaccess_32.h; it is supposed to work (and it certainly isn't supposed to trigger an ICE, so ultimately it's a gcc bug).