From: Mike Snitzer <snitzer@redhat.com>
To: Richard Weinberger <richard@nod.at>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
Artem Bityutskiy <dedekind1@gmail.com>
Subject: [RFC PATCH] UBI: fix rb_tree node comparison in add_map
Date: Fri, 21 Mar 2014 15:54:03 -0400 [thread overview]
Message-ID: <20140321195403.GA32529@redhat.com> (raw)
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 <snitzer@redhat.com>
---
drivers/mtd/ubi/fastmap.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
NOTE: I stumbled upon this code while implementing some rb_tree code
(and looking for some existing rb_tree code as a reference).
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index ead8613..60c7a20 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;
}
next reply other threads:[~2014-03-21 19:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-21 19:54 Mike Snitzer [this message]
2014-03-21 23:56 ` [RFC PATCH] UBI: fix rb_tree node comparison in add_map Richard Weinberger
2014-05-10 1:19 ` Brian Norris
2014-05-13 9:08 ` Artem Bityutskiy
2014-05-13 10:48 ` 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=20140321195403.GA32529@redhat.com \
--to=snitzer@redhat.com \
--cc=dedekind1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
/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;
as well as URLs for NNTP newsgroup(s).