rbtree: Add some necessary condition checks
PATCH 1/1 rbtree: Add some necessary condition checks
From: Zhi Yong Wu <[email protected]>
Signed-off-by Zhi Yong Wu <[email protected]>
--- include/linux/rbtree_augmented.h | 3 ++- lib/rbtree.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
include/linux/rbtree_augmented.h +2 -1
@@ -199,7 +199,8 @@ __rb_erase_augmented(struct rb_node *node, struct rb_root *root, } successor->rb_left = tmp = node->rb_left; -rb_set_parent (tmp, successor); +if (tmp) +rb_set_parent (tmp, successor); pc = node->__rb_parent_color; tmp =__rb_parent (pc);
lib/rbtree.c +2 -1
@@ -226,7 +226,8 @@ ____rb_erase_color(struct rb_node *parent, struct rb_root *root,*/ parent->rb_right = tmp1 = sibling->rb_left; sibling->rb_left = parent; -rb_set_parent_color (tmp1, parent,RB_BLACK ); +if (tmp1) +rb_set_parent_color (tmp1, parent,RB_BLACK );__rb_rotate_set_parents (parent, sibling, root,RB_RED );augment_rotate (parent, sibling);
Signature · 1 line
1.7.11.7
Andrew Morton
maintainerQuoted 3 lines · On Fri, 23 Aug 2013 23:03:13 +0800 [email protected] wrote:
From: Zhi Yong Wu <[email protected]>
Signed-off-by Zhi Yong Wu <[email protected]>
Please write a changelog, then send it again.