Author: zheng shi Date: To: YAFFS Subject: Re: [Yaffs] yaffs_WriteDataToFile has serious problems
On 2008-11-21 14:20, Cal Page wrote: > I got errors like: "writing -128982 bytes to chunk, called from around
> 4964" which brought me into yaffs_WriteDataToFile.
>
> It's bad enough when the error occurs that a while(1){} is executed and
> the kernel hangs.
>
> Here's the problems I have with this puppy:
>
> 1. You calculate the last chunk in the file with yaffs_AddrToChunk but
> then you auto-increment it. Why?
Because data chunk starts at offset 1. Offset 0 is reserved for header chunk.
>
> 2. then at ok check for curve ball, shouldn't the if be <= and not just
> < ???
>
> 3. the calculation of nBytesRead subtracts two from chunk, but this
> should be -1 even with the auto-increment.
>
> 4. at the top of the routine, if you call it with > 2048 bytes,
> yaffs_AddrToChunk gets re-calculated EVERY TIME, guaranteeing you trash
> something.
>
> Has somebody cleaned up this thing?
>
> Cal Page
>