nand_verify_buf broken ?

Thomas Gleixner tglx at linutronix.de
Mon Jul 28 11:18:17 EDT 2003


On Monday 28 July 2003 15:30, J.D. Bakker wrote:
> Hi,
>
> Context: drivers/mtd/nand/nand.c in the latest CVS.
>
> static int nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int
> len) {
> 	int i;
> 	struct nand_chip *this = mtd->priv;
>
> 	for (i=0; i<len; i++)
> 		if (buf[i] != readb(this->IO_ADDR_R))
> 			return i;
>
> 	return 0;
> }
>
> This will yield a false positive if the first byte of the buffer is
> corrupted. I didn't dig deep enough to find out who's using this and
> why (or if buf[0] is guaranteed to be correct) so no patch, sorry.

You're right. There must be return -EIO; 

It was there before the big changes for DOC support. Must have happened there.
Thanks. Will be fixed.

-- 
Thomas
________________________________________________________________________
linutronix - competence in embedded & realtime linux
http://www.linutronix.de
mail: tglx at linutronix.de




More information about the linux-mtd mailing list