linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* nand_flash_detect_onfi error
@ 2015-11-03 16:27 Renaud Barbier
  2015-11-03 16:56 ` Ezequiel Garcia
  0 siblings, 1 reply; 10+ messages in thread
From: Renaud Barbier @ 2015-11-03 16:27 UTC (permalink / raw)
  To: linux-mtd

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-11-04 17:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-03 16:27 nand_flash_detect_onfi error Renaud Barbier
2015-11-03 16:56 ` 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

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).