From patchwork Fri Jun 19 14:33:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 223751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F578C433E0 for ; Fri, 19 Jun 2020 16:31:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E97C2100A for ; Fri, 19 Jun 2020 16:31:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592584300; bh=lomYkep2VdeiNmTFXg01kC37C66Vs93apprYh2lBNRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sPvfD4xNwannY7kezxjFfv3uf/AEmrckGH5fWf2SH3LQpQUCsStuYAmoR3JCfGOZZ 9LybBZ06/D+sVAJbbuZgTj1tx4m/GEMrOuTv+SsHnb9KvtWDnk7UQpjyhz78eF3rA6 q5drv6Nmil7tCM1fEn5xMkXmBOHSkvWZYdLjjbCw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389243AbgFSQbi (ORCPT ); Fri, 19 Jun 2020 12:31:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:46900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389615AbgFSOwp (ORCPT ); Fri, 19 Jun 2020 10:52:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 982B1217D8; Fri, 19 Jun 2020 14:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578366; bh=lomYkep2VdeiNmTFXg01kC37C66Vs93apprYh2lBNRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0XiH5Dv4A7SWDF018qNICiY6r7z/GFoi6+SxOzoJasvYPOxUJpMa7eN24EahlITba HpHEzoYNKiAQHi5mPiKRdPnGSVshEdhV1KU0OfLFvXbT/+2f52Cj2m13fTud1rQd31 qgvRvOm+iIn2KkuojWlEquqOd7cgBKmaQ72Z9J+4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= , Miquel Raynal Subject: [PATCH 4.14 185/190] mtd: rawnand: brcmnand: fix hamming oob layout Date: Fri, 19 Jun 2020 16:33:50 +0200 Message-Id: <20200619141643.097877783@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141633.446429600@linuxfoundation.org> References: <20200619141633.446429600@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Álvaro Fernández Rojas commit 130bbde4809b011faf64f99dddc14b4b01f440c3 upstream. First 2 bytes are used in large-page nand. Fixes: ef5eeea6e911 ("mtd: nand: brcm: switch to mtd_ooblayout_ops") Cc: stable@vger.kernel.org Signed-off-by: Álvaro Fernández Rojas Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20200512075733.745374-2-noltari@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/brcmnand/brcmnand.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/drivers/mtd/nand/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/brcmnand/brcmnand.c @@ -911,11 +911,14 @@ static int brcmnand_hamming_ooblayout_fr if (!section) { /* * Small-page NAND use byte 6 for BBI while large-page - * NAND use byte 0. + * NAND use bytes 0 and 1. */ - if (cfg->page_size > 512) - oobregion->offset++; - oobregion->length--; + if (cfg->page_size > 512) { + oobregion->offset += 2; + oobregion->length -= 2; + } else { + oobregion->length--; + } } }