From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fX4Yu-0000Ww-7f for linux-mtd@lists.infradead.org; Sun, 24 Jun 2018 12:56:13 +0000 Date: Sun, 24 Jun 2018 14:55:48 +0200 From: Boris Brezillon To: Richard Weinberger Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 09/14] ubi: fastmap: Relax size check Message-ID: <20180624145548.2259fe38@bbrezillon> In-Reply-To: <20180613212344.11608-10-richard@nod.at> References: <20180613212344.11608-1-richard@nod.at> <20180613212344.11608-10-richard@nod.at> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Wed, 13 Jun 2018 23:23:39 +0200 Richard Weinberger wrote: > 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 Reviewed-by: Boris Brezillon > --- > 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 09a9d3a0ccf5..dabeb01af24a 100644 > --- a/drivers/mtd/ubi/fastmap.c > +++ b/drivers/mtd/ubi/fastmap.c > @@ -1168,7 +1168,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;