linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Tudor Ambarus <Tudor.Ambarus@microchip.com>,
	<linux-mtd@lists.infradead.org>
Cc: Julien Su <juliensu@mxic.com.tw>,
	ycllin@mxic.com.tw, stable@vger.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>
Subject: [PATCH 5/6] mtd: spinand: Fix OOB read
Date: Thu,  1 Oct 2020 12:20:13 +0200	[thread overview]
Message-ID: <20201001102014.20100-6-miquel.raynal@bootlin.com> (raw)
In-Reply-To: <20201001102014.20100-1-miquel.raynal@bootlin.com>

So far OOB have never been used in SPI-NAND, add the missing memcpy to
make it work properly.

Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/nand/spi/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 4a4c86d8eeb6..bec8c2a57f24 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -382,6 +382,10 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand,
 		memcpy(req->databuf.in, spinand->databuf + req->dataoffs,
 		       req->datalen);
 
+	if (req->ooblen)
+		memcpy(req->oobbuf.in, spinand->oobbuf + req->ooboffs,
+		       req->ooblen);
+
 	return 0;
 }
 
-- 
2.20.1


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

  parent reply	other threads:[~2020-10-01 10:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 10:20 [PATCH 0/6] Bringing generic ECC engine support to SPI-NAND Miquel Raynal
2020-10-01 10:20 ` [PATCH 1/6] mtd: nand: Add helpers to manage ECC engines and configurations Miquel Raynal
2020-10-30 17:28   ` Miquel Raynal
2020-10-01 10:20 ` [PATCH 2/6] dt-bindings: mtd: Deprecate nand-ecc-mode Miquel Raynal
2020-10-30 17:28   ` Miquel Raynal
2020-10-01 10:20 ` [PATCH 3/6] mtd: spinand: Use the external ECC engine logic Miquel Raynal
2020-10-30 17:28   ` Miquel Raynal
2020-10-01 10:20 ` [PATCH 4/6] mtd: spinand: Allow the case where there is no ECC engine Miquel Raynal
2020-10-30 17:28   ` Miquel Raynal
2020-10-01 10:20 ` Miquel Raynal [this message]
2020-10-30 17:27   ` [PATCH 5/6] mtd: spinand: Fix OOB read Miquel Raynal
2020-10-01 10:20 ` [PATCH 6/6] mtd: spinand: Remove outdated comment Miquel Raynal
2020-10-30 17:27   ` Miquel Raynal

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=20201001102014.20100-6-miquel.raynal@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=Tudor.Ambarus@microchip.com \
    --cc=juliensu@mxic.com.tw \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vigneshr@ti.com \
    --cc=ycllin@mxic.com.tw \
    /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 NNTP newsgroup(s).