diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-07-12 23:17:15 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:08 -0400 |
commit | 003e738d4f0f61a8711ce41a03d8fb01a1cd7733 (patch) | |
tree | 4dba3229a7fe8b7d808ecdf34d55d8aac8af4e4a /fs/bcachefs/dirent.c | |
parent | 0a70089062c63b0861217d9ffb76d3ac073d3fde (diff) | |
download | linux-003e738d4f0f61a8711ce41a03d8fb01a1cd7733.tar.gz linux-003e738d4f0f61a8711ce41a03d8fb01a1cd7733.tar.bz2 linux-003e738d4f0f61a8711ce41a03d8fb01a1cd7733.zip |
bcachefs: Ensure bad d_type doesn't oops in bch2_dirent_to_text()
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/dirent.c')
-rw-r--r-- | fs/bcachefs/dirent.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/dirent.c b/fs/bcachefs/dirent.c index d5883ab7de21..a95165b8eddf 100644 --- a/fs/bcachefs/dirent.c +++ b/fs/bcachefs/dirent.c @@ -112,7 +112,10 @@ void bch2_dirent_to_text(struct printbuf *out, struct bch_fs *c, bch_scnmemcpy(out, d.v->d_name, bch2_dirent_name_bytes(d)); - pr_buf(out, " -> %llu type %s", d.v->d_inum, bch2_d_types[d.v->d_type]); + pr_buf(out, " -> %llu type %s", d.v->d_inum, + d.v->d_type < DT_MAX + ? bch2_d_types[d.v->d_type] + : "(bad d_type)"); } static struct bkey_i_dirent *dirent_create_key(struct btree_trans *trans, |