tmem: two wrongs (or three lefts and a wrong) make a right
PATCH 1/1 tmem: two wrongs (or three lefts and a wrong) make a right
(Please apply for 4.0.x and xen-unstable.)
These two bugs apparently complement each other enough that they escaped problems in my testing, but eventually gum up the works and are obviously horribly wrong.
Found while developing tmem for native Linux.
Signed-off-by Dan Magenheimer <[email protected]>
xen/common/tmem.c +4 -4
@@ -863,17 +863,17 @@ int oid_compare(OID *left, OID *right) {if ( left->oid[0 ] == right->oid[0 ] )return 0 ; -else if ( left->oid[0 ] < left->oid[0 ] ) +else if ( left->oid[0 ] < right->oid[0 ] )return -1 ;else return 1 ; } - else if ( left->oid[1] < left->oid[1] ) + else if ( left->oid[1] < right->oid[1] ) return -1; else return 1; } -else if ( left->oid[2 ] < left->oid[2 ] ) +else if ( left->oid[2 ] < right->oid[2 ] )return -1 ;else return 1 ;
@@ -970,7 +970,7 @@ static NOINLINE int obj_rb_insert(struct { this =container_of (*new, obj_t, rb_tree_node); parent = *new; -switch (oid_compare (&obj->oid, &this->oid) ) +switch (oid_compare (&this->oid, &obj->oid) ) {case 0 :return 0 ;
xen/common/tmem.c +4 -4
@@ -863,17 +863,17 @@ int oid_compare(OID *left, OID *right) {if ( left->oid[0 ] == right->oid[0 ] )return 0 ; -else if ( left->oid[0 ] < left->oid[0 ] ) +else if ( left->oid[0 ] < right->oid[0 ] )return -1 ;else return 1 ; } - else if ( left->oid[1] < left->oid[1] ) + else if ( left->oid[1] < right->oid[1] ) return -1; else return 1; } -else if ( left->oid[2 ] < left->oid[2 ] ) +else if ( left->oid[2 ] < right->oid[2 ] )return -1 ;else return 1 ;
@@ -970,7 +970,7 @@ static NOINLINE int obj_rb_insert(struct { this =container_of (*new, obj_t, rb_tree_node); parent = *new; -switch (oid_compare (&obj->oid, &this->oid) ) +switch (oid_compare (&this->oid, &obj->oid) ) {case 0 :return 0 ;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel