[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1292777645.13362.3.camel@koala>
Date: Sun, 19 Dec 2010 18:54:05 +0200
From: Artem Bityutskiy <dedekind1@...il.com>
To: Jason Liu <liu.h.jason@...il.com>
Cc: Jason Liu <r64343@...escale.com>, David.Woodhouse@...el.com,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] mtd: nand: add check for out of page read
On Wed, 2010-12-15 at 09:55 +0800, Jason Liu wrote:
> > /* 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;
> > }
>
> Here the mtd->size in nand_base.c should be the NAND flash chip size,
I think this is partition size as well.
> while in nand_oobtest,
>
> /* Attempt to read off end of device */
> ops.mode = MTD_OOB_AUTO;
> ops.len = 0;
> ops.retlen = 0;
> ops.ooblen = mtd->ecclayout->oobavail;
> ops.oobretlen = 0;
> ops.ooboffs = 1;
> 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;
> }
> }
>
> here, mtd->size is mtd partition size right? when the mtd partition is
> not the last MTD partition, the error will happen.
I think this is the same in both. Try to debug this with printks().
>
> I have tested on real NAND, while not on nandsim.
Please, try to reproduce this with nandsim as well, and if it works, try
to find out why (using printk debugging)
--
Best Regards,
Artem Bityutskiy (Битюцкий Артём)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists