[PATCH -next] dm btree: shadow_child leaves unchecked in split_two_into_three
From: Tong Tiangen
Date: Tue Jun 01 2021 - 05:53:04 EST
Function shadow_child() leaves variable 'r' unchecked in
split_two_into_three when parent_index not equals to 0.
It's also not coordinate with above relative codes.
Fixes: dee29bf9192b ("dm btree: improve btree residency")
Signed-off-by: Tong Tiangen <tongtiangen@xxxxxxxxxx>
---
drivers/md/persistent-data/dm-btree.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c
index 3e5a90580427..0703ca7a7d9a 100644
--- a/drivers/md/persistent-data/dm-btree.c
+++ b/drivers/md/persistent-data/dm-btree.c
@@ -743,8 +743,10 @@ static int split_two_into_three(struct shadow_spine *s, unsigned parent_index,
return r;
} else {
middle_index = parent_index;
- r = shadow_child(s->info, vt, pn, parent_index - 1, &left);
right = shadow_current(s);
+ r = shadow_child(s->info, vt, pn, parent_index - 1, &left);
+ if (r)
+ return r;
}
r = new_block(s->info, &middle);
--
2.18.0.huawei.25