summaryrefslogtreecommitdiff
path: root/fs/bcachefs/backpointers.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-09-22 21:19:52 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:10:15 +0300
commit82142a5541063addd15c84fcda890675035df8aa (patch)
tree4f69642a9d89673b67faa6a54f24e0bc81be2322 /fs/bcachefs/backpointers.c
parentd8b6f8c3c6fe7eb279d031c5f7bdde086185f0d1 (diff)
downloadlinux-82142a5541063addd15c84fcda890675035df8aa.tar.xz
bcachefs: Fix a null ptr deref in bch2_get_alloc_in_memory_pos()
Reported-by: smatch Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/backpointers.c')
-rw-r--r--fs/bcachefs/backpointers.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/backpointers.c b/fs/bcachefs/backpointers.c
index 43defeaa1718..cc856150a948 100644
--- a/fs/bcachefs/backpointers.c
+++ b/fs/bcachefs/backpointers.c
@@ -703,7 +703,7 @@ static int bch2_get_alloc_in_memory_pos(struct btree_trans *trans,
--btree_nodes;
if (!btree_nodes) {
- *end = alloc_k.k->p;
+ *end = alloc_k.k ? alloc_k.k->p : SPOS_MAX;
break;
}