]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
net/garp: fix GID rbtree ordering
authorDavid Ward <david.ward@ll.mit.edu>
Mon, 9 Apr 2012 04:13:53 +0000 (04:13 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 Apr 2012 17:10:33 +0000 (13:10 -0400)
The comparison operators were backwards in both garp_attr_lookup and
garp_attr_create, so the entire GID rbtree was in reverse order.
(There was no practical side effect to this though, except that PDUs
were sent with attributes listed in reverse order, which is still
valid by the protocol. This change is only for clarity.)

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/802/garp.c

index a5c2248304397ae3d738eba7435d7dfaeb555976..8456f5d98b853b24607d8168aee1b7d9aa9fdac8 100644 (file)
@@ -157,9 +157,9 @@ static struct garp_attr *garp_attr_lookup(const struct garp_applicant *app,
        while (parent) {
                attr = rb_entry(parent, struct garp_attr, node);
                d = garp_attr_cmp(attr, data, len, type);
-               if (d < 0)
+               if (d > 0)
                        parent = parent->rb_left;
-               else if (d > 0)
+               else if (d < 0)
                        parent = parent->rb_right;
                else
                        return attr;
@@ -178,9 +178,9 @@ static struct garp_attr *garp_attr_create(struct garp_applicant *app,
                parent = *p;
                attr = rb_entry(parent, struct garp_attr, node);
                d = garp_attr_cmp(attr, data, len, type);
-               if (d < 0)
+               if (d > 0)
                        p = &parent->rb_left;
-               else if (d > 0)
+               else if (d < 0)
                        p = &parent->rb_right;
                else {
                        /* The attribute already exists; re-use it. */