Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758653AbcDLWoI (ORCPT ); Tue, 12 Apr 2016 18:44:08 -0400 Received: from down.free-electrons.com ([37.187.137.238]:51239 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757215AbcDLWoF (ORCPT ); Tue, 12 Apr 2016 18:44:05 -0400 Date: Wed, 13 Apr 2016 00:43:51 +0200 From: Boris Brezillon To: Han Xu Cc: , , , , Subject: Re: [PATCH] mtd: nand: gpmi: get correct free oob space Message-ID: <20160413004351.40064fcd@bbrezillon> In-Reply-To: <1460498793-19431-1-git-send-email-han.xu@nxp.com> References: <1460498793-19431-1-git-send-email-han.xu@nxp.com> X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1125 Lines: 42 Hi Han, On Tue, 12 Apr 2016 17:06:33 -0500 Han Xu wrote: > change the way to calculate pagesize to get correct free oob space for > legacy_set_geometry function. Are you sure it's safe to expose free OOB bytes in this case? Do you know why it wasn't done before? Best Regards, Boris > > Signed-off-by: Han Xu > --- > drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c > index 316b5ac..bda77a9 100644 > --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c > +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c > @@ -319,7 +319,8 @@ static int legacy_set_geometry(struct gpmi_nand_data *this) > return -EINVAL; > } > > - geo->page_size = mtd->writesize + mtd->oobsize; > + geo->page_size = mtd->writesize + geo->metadata_size + > + (geo->gf_len * geo->ecc_strength * geo->ecc_chunk_count) / 8; > geo->payload_size = mtd->writesize; > > /* -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com