Received: by 10.192.165.148 with SMTP id m20csp3077609imm; Sun, 22 Apr 2018 23:31:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+V9j4axkS0kZP8DkH9tLgryPLTqelJ21dWYVbNhSawi3WRbHdJueBt2zZvT3a4RDinggF7 X-Received: by 2002:a17:902:57c7:: with SMTP id g7-v6mr19549960plj.222.1524465078660; Sun, 22 Apr 2018 23:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524465078; cv=none; d=google.com; s=arc-20160816; b=FA2V4ToLb0HsIHQzD2LjzCPOtuMbbO8S2HzU51AeqDv2g2dX12f2hVDkeSIlrPfFSY owkbqWutr1dTo/gUVohNR0bVq6hzOOEBfVEKQxmuXguy1rByVLnS6CBYNhLAT2SACEUq NYNDBfbyFjUXZhJFLibVQBxKg2b1iMjEnFgSlvMUkbu06gy2NwG8m/fBupsgODehtm1A qYI5MIS/tF4jNa3Nie7seou0VxP4spZ+0WWuwJ3jzAwgXdLtl5TfLfjocBPAm8D+sZoE OgwYvK/bEyG07lhz/8EPqeJB7q9vErMiq0BLyAFyWgvd/7t+ob5/iIOUg1v6aYgxIf/3 AjfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=4+SG8rRw4zvI36oeT9O+JuSOXAVR8XWL03Ar6aBqbV4=; b=mXmjIjZfblXoY0JQT3U4Ac7xWOaxNOAA949sozG9nggyU5Caf2QC9hKBq7O4uPPy2T 4firQMVMWVq/sOtqaVHJWUmz9tWPfPmRAeeSTk/6Uh5S2fkE5mYHLJJW7kq6guz83qyH EB4fdvR/89deGVBcSdweVmJHjtGX9WiD8XdxcMYwV/uSo/CUb4l+V8l6fx/42kQvh4n7 fHrnR+nEQlkmjdRuKjiWHug4a1fpB4LDsIXop3/mAh+dS7znXSVjIf7lBjOMNrb1HVe6 zw0ubl2Z3DH6XGLjrf3mtzEtk5Hsp7nnGnlHH5XR5/3Vm0GbUxyndD4LeC2DOU0p5nmC 22xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=lsyKU7w2; dkim=pass header.i=@codeaurora.org header.s=default header.b=iQvfNTvt; 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 89-v6si11004399plc.444.2018.04.22.23.31.04; Sun, 22 Apr 2018 23:31:18 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=lsyKU7w2; dkim=pass header.i=@codeaurora.org header.s=default header.b=iQvfNTvt; 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 S1752991AbeDWG3u (ORCPT + 99 others); Mon, 23 Apr 2018 02:29:50 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:40920 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751216AbeDWG3r (ORCPT ); Mon, 23 Apr 2018 02:29:47 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 72C2060C64; Mon, 23 Apr 2018 06:29:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524464987; bh=Q4qjBXL8AagQptbZeTwUJj0vBNM/eiyQDpADUDjiwzI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lsyKU7w232EwNfnAwqT+oCUi0Qt4SMZXWdqMN007B9G32Kb+MrW45Qjsn1LcdmuzE C3YOBQlEs6cr4tlujBpYoOsA+RzMKOWNEni2D00B0sTGb0Ol2WAqrv/9lu+3/MRygk JoVl6Nvjq2K7TiaXtMIf3I/kV/V+pOMzIducKI7g= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 9C6556071A; Mon, 23 Apr 2018 06:29:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524464986; bh=Q4qjBXL8AagQptbZeTwUJj0vBNM/eiyQDpADUDjiwzI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iQvfNTvt/upvNOWzps8QTRHmmUujCkHQ9OOsq7i9tOQh9mimq4ZSHlzdBpa7wFrvT VCj737S8Uyx8bTPs/QkITsgiuMMr3YGIfh6E5NEveEIw7d8cWi7K4SErq/hJ4UomZl F0oJ2R9tXkkd4R1WP+Cntj5PpYXKZppaaH5t+INQ= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Mon, 23 Apr 2018 11:59:46 +0530 From: Abhishek Sahu To: Miquel Raynal 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 In-Reply-To: <20180422182532.221747b6@xps13> References: <1522845745-6624-1-git-send-email-absahu@codeaurora.org> <1522845745-6624-5-git-send-email-absahu@codeaurora.org> <20180410111220.3873a24c@xps13> <20180422182532.221747b6@xps13> Message-ID: <3699eb1ef15c63a4ea1490be7308d3dd@codeaurora.org> X-Sender: absahu@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-04-22 21:55, Miquel Raynal wrote: > 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 Sure Miquel. I will do the same and update the patch with more comments. Thanks, Abhishek