[Yaffs] Fix to negative hashing problem

Charles Manning manningc2 at actrix.gen.nz
Thu Feb 2 22:33:03 GMT 2006


Hi yaffsers

There was a problem whereby negative hash values could get generated.

The way that the crash was manifesting was that a negative tags objectId 
(impossible, except by major tags corruption) would create a negative hash 
array index. Not a good thing, since it would try treat other memory at 
doubly linked lists.

This problem would only occur if the tags got seriously corrupted at the 
mtd/flash level, so if you were encountering this one, you'd probably be 
getting data loss too. At least now the crash does not happen.

The simple one-liner solution is to just abs() the objectId  in the hash 
function.

I have committed a change to CVS for both yaffs and yaffs2.

-- CHarles




More information about the yaffs mailing list