* [PATCH] bcachefs: fix build on sh4
@ 2025-08-09 3:19 Kent Overstreet
2025-08-09 3:37 ` Al Viro
0 siblings, 1 reply; 2+ messages in thread
From: Kent Overstreet @ 2025-08-09 3:19 UTC (permalink / raw)
To: linux-bcachefs; +Cc: Kent Overstreet, Alexander Viro
put_user() with a 64 bit value causes an ICE on sh4.
Reported-by: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] bcachefs: fix build on sh4
2025-08-09 3:19 [PATCH] bcachefs: fix build on sh4 Kent Overstreet
@ 2025-08-09 3:37 ` Al Viro
0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2025-08-09 3:37 UTC (permalink / raw)
To: Kent Overstreet; +Cc: linux-bcachefs
On Fri, Aug 08, 2025 at 11:19:44PM -0400, Kent Overstreet wrote:
> put_user() with a 64 bit value causes an ICE on sh4.
>
> Reported-by: Alexander Viro <viro@zeniv.linux.org.uk>
> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
> ---
> 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;
> }
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).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-09 3:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-09 3:19 [PATCH] bcachefs: fix build on sh4 Kent Overstreet
2025-08-09 3:37 ` Al Viro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox