public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* bug in drivers/mtd/onenand/onenand_base.c?
@ 2007-03-22  9:36 Vitaly Wool
  2007-03-22 10:34 ` Artem Bityutskiy
  0 siblings, 1 reply; 6+ messages in thread
From: Vitaly Wool @ 2007-03-22  9:36 UTC (permalink / raw)
  To: linux-mtd

Hi,

the piece of code below, though looking harmless, might cause side effects:

/**
 * onenand_oob_64 - oob info for large (2KB) page
 */
static struct nand_ecclayout onenand_oob_64 = {
        .eccbytes       = 20,
        .eccpos         = {
                8, 9, 10, 11, 12,
                24, 25, 26, 27, 28,
                40, 41, 42, 43, 44,
                56, 57, 58, 59, 60,
                },
        .oobfree        = {
                {2, 3}, {14, 2}, {18, 3}, {30, 2},
                {34, 3}, {46, 2}, {50, 3}, {62, 2}
        }
};

The problem is, the entry of oobfree past the last valid 
one should have length 0.

Here it's not the case: all the entries are occupied by 
OOB chunks. Therefore, once we get into a loop like

        for (free = this->ecclayout->oobfree; free->length; ++free) {

we might end up scanning past the real oobfree array.

Probably the best way out, as the same thing might happen for common NAND 
as well, is to check index against MTD_MAX_OOBFREE_ENTRIES.

Comments?

Vitaly

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

* Re: bug in drivers/mtd/onenand/onenand_base.c?
  2007-03-22  9:36 Vitaly Wool
@ 2007-03-22 10:34 ` Artem Bityutskiy
  2007-03-22 10:40   ` Adrian Hunter
  0 siblings, 1 reply; 6+ messages in thread
From: Artem Bityutskiy @ 2007-03-22 10:34 UTC (permalink / raw)
  To: Vitaly Wool; +Cc: linux-mtd

On Thu, 2007-03-22 at 12:36 +0300, Vitaly Wool wrote:
> The problem is, the entry of oobfree past the last valid 
> one should have length 0.
> 
> Here it's not the case: all the entries are occupied by 
> OOB chunks. Therefore, once we get into a loop like
> 
>         for (free = this->ecclayout->oobfree; free->length; ++free) {
> 
> we might end up scanning past the real oobfree array.

We have this fixed in OneNAND.

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

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

* Re: bug in drivers/mtd/onenand/onenand_base.c?
  2007-03-22 10:34 ` Artem Bityutskiy
@ 2007-03-22 10:40   ` Adrian Hunter
  0 siblings, 0 replies; 6+ messages in thread
From: Adrian Hunter @ 2007-03-22 10:40 UTC (permalink / raw)
  To: linux-mtd

ext Artem Bityutskiy wrote:
> On Thu, 2007-03-22 at 12:36 +0300, Vitaly Wool wrote:
>> The problem is, the entry of oobfree past the last valid 
>> one should have length 0.
>>
>> Here it's not the case: all the entries are occupied by 
>> OOB chunks. Therefore, once we get into a loop like
>>
>>         for (free = this->ecclayout->oobfree; free->length; ++free) {
>>
>> we might end up scanning past the real oobfree array.
> 
> We have this fixed in OneNAND.
> 

No we don't

I thought Kyungmin Park was going to fix it 
(see http://lists.infradead.org/pipermail/linux-mtd/2007-February/017479.html)
, then I forgot about it, sorry :-(

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

* Re: bug in drivers/mtd/onenand/onenand_base.c?
       [not found] <46025ABF.3000100@nokia.com>
@ 2007-03-22 10:40 ` Vitaly Wool
  0 siblings, 0 replies; 6+ messages in thread
From: Vitaly Wool @ 2007-03-22 10:40 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-mtd

Adrian Hunter wrote:

>Yes, I thought Kyungmin Park was going to fix it.  See:
>
>http://lists.infradead.org/pipermail/linux-mtd/2007-February/017479.html
>
>  
>
Looks like it hasn't gotten in mtd main tree still.

Vitaly

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

* bug in drivers/mtd/onenand/onenand_base.c?
@ 2007-03-22 11:44 Kyungmin Park
       [not found] ` <46028A4F.9010907@ru.mvista.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Kyungmin Park @ 2007-03-22 11:44 UTC (permalink / raw)
  To: vwool; +Cc: linux-mtd

Hi Vitaly Wool,

Sorry, I'm not office so I can't access my computer.
To help your work I send the URL related this problem.
This problem is reported previous time but not commit it.

Please check this mail. It would help your work.
http://linux.omap.com/pipermail/linux-omap-open-source/2007-March/009395.htm
l

I saw your mtd git tree related with yaffs. I tested the yaffs on onenand
before. But as you know it failed.
Now with your patch how many bytes are needed in yaffs if ecc provided?
Maybe we need to modify onenand read & write function to support read/write
with oob simultaneously.
Currently it only supports separated read or oob function only, instead of
both.

If the yaffs requires less or equal with 20 bytes, it will work with
OneNAND. Of course, if the page is 1KB, it can't. Since it has only 10 bytes
OOB.

I hope yaffs can run with OneNAND.

Thank you,
Kyungmin Park

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

* RE: Onenand and yaffs [was: Re: bug in drivers/mtd/onenand/onenand_base.c?]
       [not found] ` <46028A4F.9010907@ru.mvista.com>
@ 2007-03-23  2:11   ` Kyungmin Park
  0 siblings, 0 replies; 6+ messages in thread
From: Kyungmin Park @ 2007-03-23  2:11 UTC (permalink / raw)
  To: 'Vitaly Wool'; +Cc: linux-mtd, yaffs


> 
> Kyungmin Park wrote:
> 
> >I saw your mtd git tree related with yaffs. I tested the 
> yaffs on onenand
> >before. But as you know it failed.
> >Now with your patch how many bytes are needed in yaffs if 
> ecc provided?
> >  
> >
> Not sure if I understood you right here. YAFFS2 generally needs 28 OOB
> bytes, and 16 without ECCOther.

Oh, Good!
16 bytes enough for 2KB page OneNAND. and Maybe we can run 1KB page OneNAND
with minor patch.

Note: It's out of Spec. So it's used for development only.

/**
 * onenand_oob_32 - oob info for middle (1KB) page
 */
static struct nand_ecclayout onenand_oob_32 = {
        .eccbytes       = 10,
        .eccpos         = {
                8, 9, 10, 11, 12,
                24, 25, 26, 27, 28,
                },
#ifdef ONENAND_FOR_YAFFS
        .oobfree        = { {2, 6}, {14, 2}, {18, 6}, {30, 2} }	
#else
        .oobfree        = { {2, 3}, {14, 2}, {18, 3}, {30, 2} }
#endif
};

Thank you,
Kyungmin Park

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

end of thread, other threads:[~2007-03-23  2:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-22 11:44 bug in drivers/mtd/onenand/onenand_base.c? Kyungmin Park
     [not found] ` <46028A4F.9010907@ru.mvista.com>
2007-03-23  2:11   ` Onenand and yaffs [was: Re: bug in drivers/mtd/onenand/onenand_base.c?] Kyungmin Park
     [not found] <46025ABF.3000100@nokia.com>
2007-03-22 10:40 ` bug in drivers/mtd/onenand/onenand_base.c? Vitaly Wool
  -- strict thread matches above, loose matches on Subject: below --
2007-03-22  9:36 Vitaly Wool
2007-03-22 10:34 ` Artem Bityutskiy
2007-03-22 10:40   ` Adrian Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox