linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* About MTD Testing suite included in the Linux kernel.
@ 2010-12-11 13:22 os user
  2010-12-14 16:50 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: os user @ 2010-12-11 13:22 UTC (permalink / raw)
  To: linux-mtd

Hi,

When I work on MTD testing tool (drivers/mtd/tests) included in the
Linux kernel, I found a problem.
For mtd_oobtest, I failed at the testing '4 of 5'. This testing case
will test 'reading past the device'.

Since for my Nandflash controller, no special function is provided for
reading OOB, I looked into the standard implementation 'nand_do_read_oob'.
The logic below seems a little bit confusing for me,

/* 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, "%s: Attempt read beyond end "
                                       "of device\n", __func__);
               return -EINVAL;
       }


In mtd_oobtest program, the testing code looks like,

/* Attempt to read off end of device */
               ops.mode      = MTD_OOB_AUTO;
               ops.len       = 0;
               ops.retlen    = 0;
               ops.ooblen    = mtd->ecclayout->oobavail + 1;
               ops.oobretlen = 0;
               ops.ooboffs   = 0;
               ops.datbuf    = NULL;
               ops.oobbuf    = readbuf;
               printk(PRINT_PREF "attempting to read past end of device\n");
               printk(PRINT_PREF "an error is expected...\n");
               err = mtd->read_oob(mtd, mtd->size - mtd->writesize, &ops);
               if (err) {
                       printk(PRINT_PREF "error occurred as expected\n");
                       err = 0;
               } else {
                       printk(PRINT_PREF "error: read past end of device\n");
                       errcnt += 1;
               }

It seems, according to the logic in MTD testing suite, MTD should
return an error. But I do not observed any error reported.

Could anyone please have a look at the two code pieces and tell me which
side needs a modification?

Thanks.

BR

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

* Re: About MTD Testing suite included in the Linux kernel.
  2010-12-11 13:22 About MTD Testing suite included in the Linux kernel os user
@ 2010-12-14 16:50 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2010-12-14 16:50 UTC (permalink / raw)
  To: os user; +Cc: linux-mtd

On Sat, 2010-12-11 at 21:22 +0800, os user wrote:
> Hi,
> 
> When I work on MTD testing tool (drivers/mtd/tests) included in the
> Linux kernel, I found a problem.
> For mtd_oobtest, I failed at the testing '4 of 5'. This testing case
> will test 'reading past the device'.

We are discussing the same here:

http://lists.infradead.org/pipermail/linux-mtd/2010-December/033407.html

Please, take a look there.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

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

end of thread, other threads:[~2010-12-14 16:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-11 13:22 About MTD Testing suite included in the Linux kernel os user
2010-12-14 16:50 ` Artem Bityutskiy

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