bcachefs: Fix undefined behaviour

roundup_pow_of_two(0) is undefined

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2019-10-02 09:14:32 -04:00 committed by Kent Overstreet
parent ab9ff73322
commit 618b9e575b

View File

@ -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))