From patchwork Mon May 14 11:24:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 912869 X-Patchwork-Delegate: richard@nod.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nod.at Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PzezMDhO"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40kz4t6G3Tz9s0W for ; Mon, 14 May 2018 21:29:50 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=kv2PhELtlsWmcmv77MmPPxlvWz5xXabJ18I5i6XC6yQ=; b=PzezMDhOYwXCCbss8RnurVrMy2 BFycBYvEiUVvujt56x+AU1mjwPDXCXj10IEV0XYXpVz6GbbvovuEW3yrdMzwNPS+qFgq25JiAUIDm LMEoTwiwdYeyIT6NFhxKc/SHC+Lndx/3jSiPXEmHTyhAFzVf7qSEJUuIMZhNIb8WubcC2wdR+6gOj utYNlxGK1sQOXtyr2kZlHR9mAm2lBhGpiDPItGbD1UQ6LPDJxDF8KpKyqpgDLeoQp24Vl2L6GCaXj /FDbyxXmz6B/0rZSEjM16Lwx+N/iBwHezykZxsMBaj1qfJlYEXKjNT/jB8n++fO2AMi7d1b8pEkaz reXoLONw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIBfc-00075v-0D; Mon, 14 May 2018 11:29:36 +0000 Received: from lilium.sigma-star.at ([109.75.188.150]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fIBbC-0003cd-R0 for linux-mtd@lists.infradead.org; Mon, 14 May 2018 11:25:09 +0000 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id A2C7C181A2F1F; Mon, 14 May 2018 13:24:36 +0200 (CEST) From: Richard Weinberger To: linux-mtd@lists.infradead.org Subject: [PATCH 7/8] ubi: fastmap: Relax size check Date: Mon, 14 May 2018 13:24:21 +0200 Message-Id: <20180514112422.23988-8-richard@nod.at> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180514112422.23988-1-richard@nod.at> References: <20180514112422.23988-1-richard@nod.at> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180514_042503_089854_80597094 X-CRM114-Status: GOOD ( 16.15 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Weinberger , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 --- 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;