diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-12-19 15:55:38 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-01-06 19:48:02 -0500 |
commit | f3338a733be2295c779d0f06edf7ee04e01ccddb (patch) | |
tree | 1d03808c146fe018b8f4dea7dbf755fba9053a9e | |
parent | 41fa4bbba27006347f51ea47f109ae181c0ac609 (diff) |
bcachefs: Fix bch_alloc_to_text()
We weren't guarding against the alloc key having an invalid data type.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/alloc_background.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c index ae6ae78a2618..97d3ffb4d392 100644 --- a/fs/bcachefs/alloc_background.c +++ b/fs/bcachefs/alloc_background.c @@ -392,7 +392,10 @@ void bch2_alloc_to_text(struct printbuf *out, struct bch_fs *c, struct bkey_s_c printbuf_indent_add(out, 2); prt_printf(out, "gen %u oldest_gen %u data_type %s", - a->gen, a->oldest_gen, bch2_data_types[a->data_type]); + a->gen, a->oldest_gen, + a->data_type < BCH_DATA_NR + ? bch2_data_types[a->data_type] + : "(invalid data type)"); prt_newline(out); prt_printf(out, "journal_seq %llu", a->journal_seq); prt_newline(out); |