From patchwork Fri Jul 19 09:13:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Teresa_G=C3=A1mez?= X-Patchwork-Id: 260218 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 735EE2C0121 for ; Fri, 19 Jul 2013 19:14:40 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V06l7-0000CL-Me; Fri, 19 Jul 2013 09:13:53 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V06l5-0001sB-VC; Fri, 19 Jul 2013 09:13:51 +0000 Received: from mail.phycore.de ([217.6.246.34] helo=root.phytec.de) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V06l2-0001r8-CE for linux-mtd@lists.infradead.org; Fri, 19 Jul 2013 09:13:49 +0000 Received: from idefix.phytec.de (idefix.phytec.de [172.16.0.10]) by root.phytec.de (Postfix) with ESMTP id 937D3BF0E8; Fri, 19 Jul 2013 11:06:58 +0200 (CEST) Received: from numalfix.phytec.de ([127.0.0.1]) by idefix.phytec.de (Lotus Domino Release 8.5.3FP3) with ESMTP id 2013071911132249-468373 ; Fri, 19 Jul 2013 11:13:22 +0200 Received: by numalfix.phytec.de (Postfix, from userid 1010) id 1706F1A0A08; Fri, 19 Jul 2013 11:13:21 +0200 (CEST) From: =?UTF-8?q?Teresa=20G=C3=A1mez?= To: linux-mtd@lists.infradead.org Subject: [PATCH] mtd: nand: omap2: Fix oobfree offset Date: Fri, 19 Jul 2013 11:13:22 +0200 Message-Id: <1374225202-26518-1-git-send-email-t.gamez@phytec.de> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on Idefix/Phytec(Release 8.5.3FP3|November 15, 2012) at 19.07.2013 11:13:22, Serialize by Router on Idefix/Phytec(Release 8.5.3FP3|November 15, 2012) at 19.07.2013 11:13:22, Serialize complete at 19.07.2013 11:13:22 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130719_051348_530874_F90F6E73 X-CRM114-Status: GOOD ( 13.04 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: tony@atomide.com, artem.bityutskiy@linux.intel.com, afzal@ti.com, linux-omap@vger.kernel.org, dwmw2@infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The calculation of the oobfree[0].offset is wrong when using BCH8 and elm. The layout->eccbytes is already steps*info->nand.ecc.bytes. The second multiplication with steps is too much and will create a value larger than the oob area. Fixed the calculation. Signed-off-by: Teresa Gámez --- drivers/mtd/nand/omap2.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 81b80af..922706b 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -1790,7 +1790,7 @@ static int omap3_init_bch_tail(struct mtd_info *mtd) layout->eccpos[i] = offset + i; if (info->is_elm_used && (info->nand.ecc.bytes == BCH8_SIZE)) - layout->oobfree[0].offset = 2 + layout->eccbytes * steps; + layout->oobfree[0].offset = 2 + layout->eccbytes; else layout->oobfree[0].offset = 2;