Skip to content

Commit bceb86b

Browse files
author
Kent Overstreet
committed
bcachefs: add missing bounds check in __bch2_bkey_val_invalid()
Signed-off-by: Kent Overstreet <[email protected]>
1 parent 86dbf8c commit bceb86b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/bcachefs/bkey_methods.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ int __bch2_bkey_invalid(struct bch_fs *c, struct bkey_s_c k,
175175
!(bch2_key_types_allowed[type] & BIT_ULL(k.k->type)), c, err,
176176
bkey_invalid_type_for_btree,
177177
"invalid key type for btree %s (%s)",
178-
bch2_btree_node_type_str(type), bch2_bkey_types[k.k->type]);
178+
bch2_btree_node_type_str(type),
179+
k.k->type < KEY_TYPE_MAX
180+
? bch2_bkey_types[k.k->type]
181+
: "(unknown)");
179182

180183
if (btree_node_type_is_extents(type) && !bkey_whiteout(k.k)) {
181184
bkey_fsck_err_on(k.k->size == 0, c, err,

0 commit comments

Comments
 (0)