[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240515-sponge-yin-461a31d7811e@thorsis.com>
Date: Wed, 15 May 2024 10:11:37 +0200
From: Alexander Dahl <ada@...rsis.com>
To: Sascha Hauer <s.hauer@...gutronix.de>
Cc: linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>
Subject: Re: [PATCH] mtd: rawnand: make
rawnand_check_data_only_read_support() work
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@...gutronix.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@...tlin.com> recently. o.O
Greets
Alex
Link: https://lore.kernel.org/linux-mtd/20240507160546.130255-2-miquel.raynal@bootlin.com/
Powered by blists - more mailing lists