mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
bcachefs: Fix shift overflow in btree_lost_data()
Reported-by: syzbot+29f65db1a5fe427b5c56@syzkaller.appspotmail.com
Fixes: 55936afe11
("bcachefs: Flag btrees with missing data")
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
9667214b30
commit
f108ddd467
2 changed files with 9 additions and 0 deletions
|
@ -1555,6 +1555,12 @@ enum btree_id {
|
||||||
BTREE_ID_NR
|
BTREE_ID_NR
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Maximum number of btrees that we will _ever_ have under the current scheme,
|
||||||
|
* where we refer to them with bitfields
|
||||||
|
*/
|
||||||
|
#define BTREE_ID_NR_MAX 64
|
||||||
|
|
||||||
static inline bool btree_id_is_alloc(enum btree_id id)
|
static inline bool btree_id_is_alloc(enum btree_id id)
|
||||||
{
|
{
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
|
|
@ -35,6 +35,9 @@
|
||||||
|
|
||||||
void bch2_btree_lost_data(struct bch_fs *c, enum btree_id btree)
|
void bch2_btree_lost_data(struct bch_fs *c, enum btree_id btree)
|
||||||
{
|
{
|
||||||
|
if (btree >= BTREE_ID_NR_MAX)
|
||||||
|
return;
|
||||||
|
|
||||||
u64 b = BIT_ULL(btree);
|
u64 b = BIT_ULL(btree);
|
||||||
|
|
||||||
if (!(c->sb.btrees_lost_data & b)) {
|
if (!(c->sb.btrees_lost_data & b)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue