From: Mike Snitzer Date: Fri, 21 Mar 2014 19:54:03 +0000 (-0400) Subject: UBI: fix rb_tree node comparison in add_map X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=604b592;p=linux-beck.git UBI: fix rb_tree node comparison in add_map The comparisons used in add_vol() shouldn't be identical. Pretty sure the following is correct but it is completely untested. Signed-off-by: Mike Snitzer Acked-by: Richard Weinberger Signed-off-by: Artem Bityutskiy --- diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index c5dad652614d..b04e7d059888 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c @@ -125,9 +125,9 @@ static struct ubi_ainf_volume *add_vol(struct ubi_attach_info *ai, int vol_id, parent = *p; av = rb_entry(parent, struct ubi_ainf_volume, rb); - if (vol_id > av->vol_id) + if (vol_id < av->vol_id) p = &(*p)->rb_left; - else if (vol_id > av->vol_id) + else p = &(*p)->rb_right; }