Commit d5b98fe2 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix rand_delete() test

When we didn't find a key to delete we were getting a null ptr deref.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent a2bfc841
...@@ -563,15 +563,14 @@ static int __do_delete(struct btree_trans *trans, struct bpos pos) ...@@ -563,15 +563,14 @@ static int __do_delete(struct btree_trans *trans, struct bpos pos)
iter = bch2_trans_get_iter(trans, BTREE_ID_XATTRS, pos, iter = bch2_trans_get_iter(trans, BTREE_ID_XATTRS, pos,
BTREE_ITER_INTENT); BTREE_ITER_INTENT);
ret = PTR_ERR_OR_ZERO(iter);
if (ret)
goto err;
k = bch2_btree_iter_peek(iter); k = bch2_btree_iter_peek(iter);
ret = bkey_err(k); ret = bkey_err(k);
if (ret) if (ret)
goto err; goto err;
if (!k.k)
goto err;
bkey_init(&delete.k); bkey_init(&delete.k);
delete.k.p = k.k->p; delete.k.p = k.k->p;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment