[Yaffs] yaffs_WriteDataToFile has serious problems

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Cal Page
Date:  
To: yaffs@lists.aleph1.co.uk
Subject: [Yaffs] yaffs_WriteDataToFile has serious problems
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?

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