diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-03-15 01:20:20 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-03-15 02:45:54 +0300 |
commit | 1a2b74d0a2a46c219b25fdb0efcf9cd7f55cfe5e (patch) | |
tree | 2dfaadec2a95382bfa0da9d8f7b1a24c37965f2b | |
parent | 90fd9ad5b0c981693c8512d9da01f14fb6596e9d (diff) | |
download | linux-1a2b74d0a2a46c219b25fdb0efcf9cd7f55cfe5e.tar.xz |
bcachefs: fix build on 32 bit in get_random_u64_below()
bare 64 bit divides not allowed, whoops
arm-linux-gnueabi-ld: drivers/char/random.o: in function `__get_random_u64_below':
drivers/char/random.c:602:(.text+0xc70): undefined reference to `__aeabi_uldivmod'
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/util.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c index 8e3ab4bf79a9..da2cd11b3025 100644 --- a/fs/bcachefs/util.c +++ b/fs/bcachefs/util.c @@ -663,7 +663,8 @@ u64 bch2_get_random_u64_below(u64 ceil) u64 mult = ceil * rand; if (unlikely(mult < ceil)) { - u64 bound = -ceil % ceil; + u64 bound; + div64_u64_rem(-ceil, ceil, &bound); while (unlikely(mult < bound)) { rand = get_random_u64(); mult = ceil * rand; |