projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
90fd9ad
)
bcachefs: fix build on 32 bit in get_random_u64_below()
author
Kent Overstreet
<kent.overstreet@linux.dev>
Fri, 14 Mar 2025 22:20:20 +0000
(18:20 -0400)
committer
Kent Overstreet
<kent.overstreet@linux.dev>
Fri, 14 Mar 2025 23:45:54 +0000
(19:45 -0400)
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>
fs/bcachefs/util.c
patch
|
blob
|
history
diff --git
a/fs/bcachefs/util.c
b/fs/bcachefs/util.c
index
8e3ab4b
..
da2cd11
100644
(file)
--- 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;