On Tue, 2007-09-11 at 11:35 +0300, Artem Bityutskiy wrote:
Yes, it makes sense.
Actually, I debugged both oobtest.c and drivers/mtd/nand/nand_base.c
in the kernel nand_base.c
mtd->read_oob() --> nand_read_oob() --> nand_do_read_oob() -->
chip->ecc.read_oob() --> nand_read_oob_std() --> chip->read_buf() -->
bf5xx_nand.c bf5xx_nand_dma_read_buf().
In the calling path, rage check should not be in my driver code
bf5xx_nand_dma_read_buf() like other low level nand controller drivers.
It is already in nand_do_read_oob() as below:
---
/* Do not allow reads past end of device */
if (unlikely(from >= mtd->size ||
ops->ooboffs + readlen > ((mtd->size >> chip->page_shift) -
(from >> chip->page_shift)) * len)) {
DEBUG(MTD_DEBUG_LEVEL0, "nand_read_oob: "
"Attempt read beyond end of device\n");
return -EINVAL;
}
---
maybe this condition testing does not include your case. I am not sure,
still busy at other task.
Good news. Thanks
Best Regards,
- Bryan Wu
-