---
tools.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/tools.c b/tools.c
index 186b703463a5..992f4776281a 100644
--- a/tools.c
+++ b/tools.c
@@ -4374,8 +4374,8 @@ rbtree_iteration(ulong node_p, struct tree_data *td, char *pos)
{
int i;
uint print_radix;
- ulong struct_p, left_p, right_p;
- char left_pos[BUFSIZE], right_pos[BUFSIZE];
+ ulong struct_p, new_p;
+ char new_pos[BUFSIZE];
static struct req_entry **e;
if (!node_p)
@@ -4430,16 +4430,17 @@ rbtree_iteration(ulong node_p, struct tree_data *td, char *pos)
}
}
- readmem(node_p+OFFSET(rb_node_rb_left), KVADDR, &left_p,
- sizeof(void *), "rb_node rb_left", FAULT_ON_ERROR);
- readmem(node_p+OFFSET(rb_node_rb_right), KVADDR, &right_p,
- sizeof(void *), "rb_node rb_right", FAULT_ON_ERROR);
-
- sprintf(left_pos, "%s/l", pos);
- sprintf(right_pos, "%s/r", pos);
+ if ( readmem(node_p+OFFSET(rb_node_rb_left), KVADDR, &new_p,
+ sizeof(void *), "rb_node rb_left", RETURN_ON_ERROR)) {
+ sprintf(new_pos, "%s/l", pos);
+ rbtree_iteration(new_p, td, new_pos);
+ }
- rbtree_iteration(left_p, td, left_pos);
- rbtree_iteration(right_p, td, right_pos);
+ if ( readmem(node_p+OFFSET(rb_node_rb_right), KVADDR, &new_p,
+ sizeof(void *), "rb_node rb_right", RETURN_ON_ERROR)) {
+ sprintf(new_pos, "%s/r", pos);
+ rbtree_iteration(new_p, td, new_pos);
+ }
}
void
--
2.16.2