All of lore.kernel.org
 help / color / mirror / Atom feed
From: Renaud Barbier <renaud.barbier@ge.com>
To: linux-mtd@lists.infradead.org
Subject: nand_flash_detect_onfi error
Date: Tue, 3 Nov 2015 16:27:32 +0000	[thread overview]
Message-ID: <5638E074.5070800@ge.com> (raw)

In the file drivers/mtd/nand/nand_base.c, in function
nand_flash_detect_onfi  reading the ONFI data can be run up to 3 times
when there is a CRC error detected in the onfi data:

The function call chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); is located
outside the first for loop:

chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1);
for (i = 0; i < 3; i++) {
	for (j = 0; j < sizeof(*p); j++)
		((uint8_t *)p)[j] = chip->read_byte(mtd);
	if (onfi_crc16(ONFI_CRC_BASE, (uint8_t *)p, 254) ==
			le16_to_cpu(p->crc)) {
		break;
	}
}

This results in a read beyond buffer error if the data have to be read
more than once.

This error can also be found in U-boot and barebox.

             reply	other threads:[~2015-11-03 16:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03 16:27 Renaud Barbier [this message]
2015-11-03 16:56 ` nand_flash_detect_onfi error Ezequiel Garcia
2015-11-03 20:25   ` Boris Brezillon
2015-11-03 20:45     ` Brian Norris
2015-11-03 20:54       ` Boris Brezillon
2015-11-03 20:57         ` Brian Norris
2015-11-03 20:59     ` Ezequiel Garcia
2015-11-03 21:18       ` Boris Brezillon
2015-11-04 16:24         ` Renaud Barbier
2015-11-04 17:54           ` Brian Norris

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=5638E074.5070800@ge.com \
    --to=renaud.barbier@ge.com \
    --cc=linux-mtd@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.