mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 23:05:25 -04:00
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user