summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-09-22 14:19:52 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:15 -0400
commit82142a5541063addd15c84fcda890675035df8aa (patch)
tree4f69642a9d89673b67faa6a54f24e0bc81be2322 /fs
parentd8b6f8c3c6fe7eb279d031c5f7bdde086185f0d1 (diff)
downloadlinux-stable-82142a5541063addd15c84fcda890675035df8aa.tar.gz
linux-stable-82142a5541063addd15c84fcda890675035df8aa.tar.bz2
linux-stable-82142a5541063addd15c84fcda890675035df8aa.zip
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')
-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;
}