All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: linux-mtd@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, Richard Weinberger <richard@nod.at>
Subject: [PATCH 7/8] ubi: fastmap: Relax size check
Date: Mon, 14 May 2018 13:24:21 +0200	[thread overview]
Message-ID: <20180514112422.23988-8-richard@nod.at> (raw)
In-Reply-To: <20180514112422.23988-1-richard@nod.at>

While attaching via fastmap we verify whether the found fastmap
is as large as we have computed.
With preseeded Fastmaps this assumtion can fail since ubinize cannot
know the total size of the MTD and uses the number if used PEBs for
the calculation.
Therefore the found fastmap might be smaller than the kernel expects.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 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 5ec14fd70c13..262497996954 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -1120,7 +1120,7 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
 	}
 
 	fm_size = ubi->leb_size * used_blocks;
-	if (fm_size != ubi->fm_size) {
+	if (fm_size > ubi->fm_size) {
 		ubi_err(ubi, "bad fastmap size: %zi, expected: %zi",
 			fm_size, ubi->fm_size);
 		ret = UBI_BAD_FASTMAP;
-- 
2.13.6

  parent reply	other threads:[~2018-05-14 11:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14 11:24 [PATCH 0/8] ubi: fastmap: Support for preseeded fastmap Richard Weinberger
2018-05-14 11:24 ` [PATCH 1/8] ubi: fastmap: Add support for flags Richard Weinberger
2018-05-14 11:24 ` [PATCH 2/8] ubi: fastmap: Add UBI_FM_SB_PRESEEDED_FLG flag Richard Weinberger
2018-05-14 11:24 ` [PATCH 3/8] ubi: fastmap: Implement PEB fixup Richard Weinberger
2018-05-14 11:24 ` [PATCH 4/8] ubi: fastmap: Handle bad block count for preseeded fastmap case Richard Weinberger
2018-05-14 11:24 ` [PATCH 5/8] ubi: fastmap: Fixup pool sizes for preseeded fastmaps Richard Weinberger
2018-05-14 11:24 ` [PATCH 6/8] ubi: fastmap: Scan empty space if fastmap is preseeded Richard Weinberger
2018-05-14 11:24 ` Richard Weinberger [this message]
2018-05-14 11:24 ` [PATCH 8/8] ubi: Fix assert in ubi_wl_init Richard Weinberger

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=20180514112422.23988-8-richard@nod.at \
    --to=richard@nod.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.