diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-12-07 17:44:12 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:08:49 +0200 |
commit | d5b98fe2d764170e7a30eda8b94780aa6a0af129 (patch) | |
tree | 8445aede57c92d6f12baf1cb5572edd2d4c205a3 /fs/bcachefs/tests.c | |
parent | bcachefs: Try to print full btree error message (diff) | |
download | linux-d5b98fe2d764170e7a30eda8b94780aa6a0af129.tar.xz linux-d5b98fe2d764170e7a30eda8b94780aa6a0af129.zip |
bcachefs: Fix rand_delete() test
When we didn't find a key to delete we were getting a null ptr deref.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/tests.c')
-rw-r--r-- | fs/bcachefs/tests.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/bcachefs/tests.c b/fs/bcachefs/tests.c index 2acecbca212e..6d0f8e233e8b 100644 --- a/fs/bcachefs/tests.c +++ b/fs/bcachefs/tests.c @@ -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, BTREE_ITER_INTENT); - ret = PTR_ERR_OR_ZERO(iter); - if (ret) - goto err; - k = bch2_btree_iter_peek(iter); ret = bkey_err(k); if (ret) goto err; + if (!k.k) + goto err; + bkey_init(&delete.k); delete.k.p = k.k->p; |