Commit d6efd42a authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: Fix infinite loop in journal_entry_btree_keys_to_text()



Fix an infinite loop when bkey_i->k.u64s is 0.

This only happens in userspace, where 'bcachefs list_journal' can print
the entire contents of the journal, and non-dirty entries aren't
validated.

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent cd04497b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -429,6 +429,10 @@ static void journal_entry_btree_keys_to_text(struct printbuf *out, struct bch_fs
	bool first = true;

	jset_entry_for_each_key(entry, k) {
		/* We may be called on entries that haven't been validated: */
		if (!k->k.u64s)
			break;

		if (!first) {
			prt_newline(out);
			bch2_prt_jset_entry_type(out, entry->type);