diff options
author | Jens Axboe <axboe@suse.de> | 2006-07-11 21:15:52 +0200 |
---|---|---|
committer | Jens Axboe <axboe@nelson.home.kernel.dk> | 2006-09-30 20:26:56 +0200 |
commit | 10fd48f2376db52f08bf0420d2c4f580e39269e1 (patch) | |
tree | 89de18dcda9c8a09937187a0e8d138cfe3cb4089 /lib/rbtree.c | |
parent | 9817064b68fef7e4580c6df1ea597e106b9ff88b (diff) | |
download | kernel_samsung_tuna-10fd48f2376db52f08bf0420d2c4f580e39269e1.zip kernel_samsung_tuna-10fd48f2376db52f08bf0420d2c4f580e39269e1.tar.gz kernel_samsung_tuna-10fd48f2376db52f08bf0420d2c4f580e39269e1.tar.bz2 |
[PATCH] rbtree: fixed reversed RB_EMPTY_NODE and rb_next/prev
The conditions got reserved. Also make rb_next() and rb_prev() check
for the empty condition.
Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'lib/rbtree.c')
-rw-r--r-- | lib/rbtree.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/rbtree.c b/lib/rbtree.c index 1e55ba1..48499c2 100644 --- a/lib/rbtree.c +++ b/lib/rbtree.c @@ -322,6 +322,9 @@ struct rb_node *rb_next(struct rb_node *node) { struct rb_node *parent; + if (rb_parent(node) == node) + return NULL; + /* If we have a right-hand child, go down and then left as far as we can. */ if (node->rb_right) { @@ -348,6 +351,9 @@ struct rb_node *rb_prev(struct rb_node *node) { struct rb_node *parent; + if (rb_parent(node) == node) + return NULL; + /* If we have a left-hand child, go down and then right as far as we can. */ if (node->rb_left) { |