mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 09/10] UBI: init_volumes: Ignore volumes with no LEBs
Date: Thu, 11 Sep 2014 17:16:09 +0200	[thread overview]
Message-ID: <1410448570-2054-10-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1410448570-2054-1-git-send-email-s.hauer@pengutronix.de>

From: Richard Weinberger <richard@nod.at>

UBI assumes that ubi_attach_info will only contain ubi_ainf_volume
structures for volumes with at least one LEB.
In scanning mode this is true because UBI can nicely create a ubi_ainf_volume
on demand while creating the EBA table.

For fastmap this is not true, the fastmap on-flash structure has a list of
all volumes, the ubi_ainf_volume structures are created from this list.
So it can happen that an empty volume ends up in init_volumes().

We can easely deal with that by looking into ->leb_count too.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
 drivers/mtd/ubi/vtbl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 48b2915..c15809a 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -580,7 +580,7 @@ static int init_volumes(struct ubi_device *ubi,
 
 		/* Static volumes only */
 		av = ubi_find_av(ai, i);
-		if (!av) {
+		if (!av || !av->leb_count) {
 			/*
 			 * No eraseblocks belonging to this volume found. We
 			 * don't actually know whether this static volume is
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2014-09-11 15:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 15:16 UBI patches Sascha Hauer
2014-09-11 15:16 ` [PATCH 01/10] UBI: fix error return code Sascha Hauer
2014-09-11 15:16 ` [PATCH 02/10] UBI: avoid program operation on NOR flash after erasure interrupted Sascha Hauer
2014-09-11 15:16 ` [PATCH 03/10] UBI: fix some use after free bugs Sascha Hauer
2014-09-11 15:16 ` [PATCH 04/10] UBI: fix error path in __wl_get_peb Sascha Hauer
2014-09-11 15:16 ` [PATCH 05/10] UBI: fix ubi free PEBs count calculation Sascha Hauer
2014-09-11 15:16 ` [PATCH 06/10] UBI: fix rb_tree node comparison in add_map Sascha Hauer
2014-09-11 15:16 ` [PATCH 07/10] UBI: fix the volumes tree sorting criteria Sascha Hauer
2014-09-11 15:16 ` [PATCH 08/10] UBI: fastmap: do not miss bit-flips Sascha Hauer
2014-09-11 15:16 ` Sascha Hauer [this message]
2014-09-11 15:16 ` [PATCH 10/10] UBI: bugfix in ubi_wl_flush() Sascha Hauer

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=1410448570-2054-10-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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