public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: linux-mtd@lists.infradead.org
Cc: Heiko Schocher <hs@denx.de>,
	Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Mike Snitzer <snitzer@redhat.com>, Wolfgang Denk <wd@denx.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] ubi: fix correct rb_tree node comparison in add_vol
Date: Tue, 24 Jun 2014 09:25:18 +0200	[thread overview]
Message-ID: <1403594718-20595-1-git-send-email-hs@denx.de> (raw)

Commit 604b592e6fd3c98f21435e1181ba7723ffc24715 ("UBI: fix rb_tree node comparison in add_map")

introduced problems with attaching ubi fastmap images,
created with older kernel.

As in ubi_find_av() from attach.c is
[...]
                if (vol_id > av->vol_id)
                        p = p->rb_left;
                else
                        p = p->rb_right;

sync this logic also in add_vol() with this.

With this patch attaching older ubi images works again.

Signed-off-by: Heiko Schocher <hs@denx.de>

---

Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: linux-mtd@lists.infradead.org
Cc: linux-kernel@vger.kernel.org

 drivers/mtd/ubi/fastmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index b04e7d0..72f39da 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -125,7 +125,7 @@ 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
 			p = &(*p)->rb_right;
-- 
1.8.3.1


             reply	other threads:[~2014-06-24  7:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24  7:25 Heiko Schocher [this message]
2014-06-25 21:11 ` [PATCH] ubi: fix correct rb_tree node comparison in add_vol Richard Weinberger
2014-06-30 15:47 ` Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403594718-20595-1-git-send-email-hs@denx.de \
    --to=hs@denx.de \
    --cc=artem.bityutskiy@linux.intel.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=snitzer@redhat.com \
    --cc=wd@denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox