summaryrefslogtreecommitdiff
path: root/fs/bcachefs/alloc_background.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-12-19 23:55:38 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:49 +0300
commitf52dd1ae20ac8094eb881f816e7274d3f7910a84 (patch)
tree6651bb888d221df6ff738598fafd493ee1e5c167 /fs/bcachefs/alloc_background.c
parent393a1f6863790fddf8b53bfb81f2c984cdbc1990 (diff)
downloadlinux-f52dd1ae20ac8094eb881f816e7274d3f7910a84.tar.xz
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>
Diffstat (limited to 'fs/bcachefs/alloc_background.c')
-rw-r--r--fs/bcachefs/alloc_background.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index d75738134f94..388a44858097 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -351,7 +351,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);