mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-02 14:34:13 -04:00
bcachefs: Fix an out-of-bounds shift
roundup_pow_of_two() is undefined for 0 - oops. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
@@ -2879,7 +2879,7 @@ void __bch2_trans_init(struct btree_trans *trans, struct bch_fs *c, unsigned fn_
|
||||
bch2_trans_alloc_paths(trans, c);
|
||||
|
||||
s = btree_trans_stats(trans);
|
||||
if (s) {
|
||||
if (s && s->max_mem) {
|
||||
unsigned expected_mem_bytes = roundup_pow_of_two(s->max_mem);
|
||||
|
||||
trans->mem = kmalloc(expected_mem_bytes, GFP_KERNEL);
|
||||
@@ -2890,9 +2890,9 @@ void __bch2_trans_init(struct btree_trans *trans, struct bch_fs *c, unsigned fn_
|
||||
} else {
|
||||
trans->mem_bytes = expected_mem_bytes;
|
||||
}
|
||||
|
||||
trans->nr_max_paths = s->nr_max_paths;
|
||||
}
|
||||
if (s)
|
||||
trans->nr_max_paths = s->nr_max_paths;
|
||||
|
||||
trans->srcu_idx = srcu_read_lock(&c->btree_trans_barrier);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user