projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ab9ff73
)
bcachefs: Fix undefined behaviour
author
Kent Overstreet
<kent.overstreet@gmail.com>
Wed, 2 Oct 2019 13:14:32 +0000
(09:14 -0400)
committer
Kent Overstreet
<kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:28 +0000
(17:08 -0400)
roundup_pow_of_two(0) is undefined
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/ec.c
patch
|
blob
|
history
diff --git
a/fs/bcachefs/ec.c
b/fs/bcachefs/ec.c
index 155e7c9bd89fe6474a8a3022454d0285887e660e..424d5cf48893a1befc1023bcff6a46ea0a9a6843 100644
(file)
--- a/
fs/bcachefs/ec.c
+++ b/
fs/bcachefs/ec.c
@@
-1351,6
+1351,9
@@
int bch2_ec_mem_alloc(struct bch_fs *c, bool gc)
if (ret)
return ret;
+ if (!idx)
+ return 0;
+
if (!gc &&
!init_heap(&c->ec_stripes_heap, roundup_pow_of_two(idx),
GFP_KERNEL))