diff options
author | Keir Fraser <keir@xen.org> | 2010-12-15 10:27:18 +0000 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2010-12-15 10:27:18 +0000 |
commit | b406d3e356621425853fed553bd3808ecfcba852 (patch) | |
tree | 2aed8429b0dfb3a0430f6588cfaee4f87fa8e9ca /xen/common/tmem.c | |
parent | e03284b00e3690bc96e0092dfc248bb6e5290ee4 (diff) | |
download | xen-b406d3e356621425853fed553bd3808ecfcba852.tar.gz xen-b406d3e356621425853fed553bd3808ecfcba852.tar.bz2 xen-b406d3e356621425853fed553bd3808ecfcba852.zip |
tmem: two wrongs (or three lefts and a wrong) make a right
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 <dan.magenheimer@oracle.com>
Diffstat (limited to 'xen/common/tmem.c')
-rw-r--r-- | xen/common/tmem.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/xen/common/tmem.c b/xen/common/tmem.c index 6aed0a5908..1c155db690 100644 --- a/xen/common/tmem.c +++ b/xen/common/tmem.c @@ -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 rb_root *root, obj_t *obj) { 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; |