bcachefs: fix unsafety in bch2_extent_ptr_to_text()

Need to check if we have a valid bucket before checking if ptr is stale

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2024-04-11 21:20:27 -04:00
parent 87cb0239c8
commit dc32c118ec
1 changed files with 3 additions and 1 deletions

View File

@ -998,7 +998,9 @@ void bch2_extent_ptr_to_text(struct printbuf *out, struct bch_fs *c, const struc
prt_str(out, " cached");
if (ptr->unwritten)
prt_str(out, " unwritten");
if (ca && ptr_stale(ca, ptr))
if (b >= ca->mi.first_bucket &&
b < ca->mi.nbuckets &&
ptr_stale(ca, ptr))
prt_printf(out, " stale");
}
}