Received: by 10.192.165.148 with SMTP id m20csp2554070imm; Sun, 22 Apr 2018 09:27:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+ucuM7ID1Y1ps/uUNuPg2wmvq5wYz3avKwte2Ixj7/ZgR1Mf8rdzWiq83YaWz+y0DlhX33 X-Received: by 10.99.107.65 with SMTP id g62mr14342095pgc.180.1524414442187; Sun, 22 Apr 2018 09:27:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524414442; cv=none; d=google.com; s=arc-20160816; b=z1jO3B8YNwqa+8GgQ9vgR5dpe2I8FB/Gd3V5j4BK2I6PSqkGGQ1cKcg0WNrTXDh65A DEdt+cFeurUzbthJxV9BaF4qevLS50NEdDaJK3xaRIAqM0KIDaujx2/Qa5V2Gez9U3tG hdJferU6Sjm3LYAE7q57VqO9AGRNwGrtF5SCbvXp5RsU9wPsFfDntNGrBZ5FrERZXSs4 vno7x+02Hi2lRbxOUdxX6plbn7Cc43IPVlJ97LXgnucgnRs1xewhdWLxJS+gLYIcgrwG 7XpNBPoSZ9pG0QW3LqsKRsTiHJYryRdLFy3taoik1RCEMv+MOLHi68Q1e8EO/PbfevVp 70ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=cclKvg0hmVka7jQlJwrtYIRQUwwcACVR7iyPc+3g1fk=; b=QQrWDSbbW/8+/I8RVu0gCCDCFaAFfruQEwrSeUw4ct6K89mYf1W4JRJC11aY40C0Ue D9kXKMlErjQdQm8BSvbzV9okUvrt2RaIaAFcgJPkNE3kHkm/Bw6j/eRgBcRe8au3ZRDG wbDKwvrCmn+A+A5orrEcOiM+7zSTbux3cNiR3wWcOz59tm1lAf9uFawYkqqmf36KaBkq 5wnC2L1MWlhHXnE6H/4oIHyeMaUTWLh96Jo/s7oRL6cWreUCre2rC5+RQ8QPjHTq/JZF a8X6pmtViatLU93X9ymcRmu7LHK80T57HwROdRe1HDiZC6/1+HTvaza9XlrdVxA0D4rt LAAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m198si8060773pga.107.2018.04.22.09.27.06; Sun, 22 Apr 2018 09:27:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752540AbeDVQZr convert rfc822-to-8bit (ORCPT + 99 others); Sun, 22 Apr 2018 12:25:47 -0400 Received: from mail.bootlin.com ([62.4.15.54]:45783 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751095AbeDVQZp (ORCPT ); Sun, 22 Apr 2018 12:25:45 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 8C5342076C; Sun, 22 Apr 2018 18:25:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from xps13 (unknown [91.224.148.103]) by mail.bootlin.com (Postfix) with ESMTPSA id DAD782064B; Sun, 22 Apr 2018 18:25:32 +0200 (CEST) Date: Sun, 22 Apr 2018 18:25:32 +0200 From: Miquel Raynal To: Abhishek Sahu Cc: Boris Brezillon , Archit Taneja , Richard Weinberger , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Marek Vasut , linux-mtd@lists.infradead.org, Cyrille Pitchen , Andy Gross , Brian Norris , David Woodhouse Subject: Re: [PATCH 4/9] mtd: nand: qcom: fix null pointer access for erased buffer detection Message-ID: <20180422182532.221747b6@xps13> In-Reply-To: References: <1522845745-6624-1-git-send-email-absahu@codeaurora.org> <1522845745-6624-5-git-send-email-absahu@codeaurora.org> <20180410111220.3873a24c@xps13> Organization: Bootlin X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Abhishek, On Thu, 12 Apr 2018 12:24:16 +0530, Abhishek Sahu wrote: > On 2018-04-10 14:42, Miquel Raynal wrote: > > Hi Abhishek, > > > On Wed, 4 Apr 2018 18:12:20 +0530, Abhishek Sahu > > wrote: > > >> parse_read_errors can be called with only oob buf also in which > >> case data_buf will be NULL. If data_buf is NULL, then don’t > >> treat this page as completely erased in case of ECC uncorrectable > >> error. > >> >> Signed-off-by: Abhishek Sahu > >> --- > >> drivers/mtd/nand/qcom_nandc.c | 7 +++++-- > >> 1 file changed, 5 insertions(+), 2 deletions(-) > >> >> diff --git a/drivers/mtd/nand/qcom_nandc.c >> b/drivers/mtd/nand/qcom_nandc.c > >> index 57c16a6..0ebcc55 100644 > >> --- a/drivers/mtd/nand/qcom_nandc.c > >> +++ b/drivers/mtd/nand/qcom_nandc.c > >> @@ -1607,9 +1607,11 @@ static int parse_read_errors(struct >> qcom_nand_host *host, u8 *data_buf, > >> if (host->bch_enabled) { > >> erased = (erased_cw & ERASED_CW) == ERASED_CW ? > >> true : false; > > > Why the parse_read_errors() function could not be called without > > data_buf when using BCH? Are you sure the situation can only happen > > without it? > > > host->bch_enabled case is different where controller itself tells > regarding erased page in status register. > > > Would the following apply here too, with a: > > > erased_chunk_check_and_fixup will be used only for 4 bit RS ECC > code in which there is no support from HW for erased page detection > and we need to check few data bytes value. So please explain this with a comment. Thanks, Miquèl