Linux-mtd Archive mirror
 help / color / mirror / Atom feed
From: Alexander Dahl <ada@thorsis.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>
Subject: Re: [PATCH] mtd: rawnand: make rawnand_check_data_only_read_support() work
Date: Wed, 15 May 2024 10:11:37 +0200	[thread overview]
Message-ID: <20240515-sponge-yin-461a31d7811e@thorsis.com> (raw)
In-Reply-To: <20240514103355.817056-1-s.hauer@pengutronix.de>

Hello Sascha,

Am Tue, May 14, 2024 at 12:33:55PM +0200 schrieb Sascha Hauer:
> rawnand_check_data_only_read_support() calls nand_read_data_op() with a
> NULL pointer as buffer which will immediately return an error. Allow a
> NULL buffer pointer when check_only is requested. This should be safe to
> do as nand_read_data_op() has no business in touching the buffer in
> check_only mode.
> 
> Fixes: 9f820fc0651c ("mtd: rawnand: Check the data only read pattern only once")
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  drivers/mtd/nand/raw/nand_base.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index d7dbbd469b892..a5e7d8deafbbe 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -2173,7 +2173,7 @@ EXPORT_SYMBOL_GPL(nand_reset_op);
>  int nand_read_data_op(struct nand_chip *chip, void *buf, unsigned int len,
>  		      bool force_8bit, bool check_only)
>  {
> -	if (!len || !buf)
> +	if (!len || (!buf && !check_only))
>  		return -EINVAL;
>  
>  	if (nand_has_exec_op(chip)) {

A very similar patch has been proposed by Miquèl with
<20240507160546.130255-2-miquel.raynal@bootlin.com> recently. o.O

Greets
Alex

Link: https://lore.kernel.org/linux-mtd/20240507160546.130255-2-miquel.raynal@bootlin.com/

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

      reply	other threads:[~2024-05-15  8:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14 10:33 [PATCH] mtd: rawnand: make rawnand_check_data_only_read_support() work Sascha Hauer
2024-05-15  8:11 ` Alexander Dahl [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240515-sponge-yin-461a31d7811e@thorsis.com \
    --to=ada@thorsis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).