Rockbox mail archiveSubject: Re: Nasty FAT bug killed
Re: Nasty FAT bug killed
From: Linus Nielsen Feltzing <linus_at_haxx.se>
Date: Wed, 05 Mar 2003 02:25:26 +0100
Greg Haerr wrote:
>>I just found and viciously killed a nasty bug in the FAT driver.
> What was it?
The update_fat_entry() function attempted to set a FAT cache entry dirty
after updating it, but it set the wrong entry. This only happened on
file systems that were formatted with a ReservedSectors field set to
something other than 32.
fat_cache[sector % FAT_CACHE_MASK].dirty = true;
fat_cache[(sector + bpb.bpb_rsvdseccnt) % FAT_CACHE_MASK].dirty = true;
The old code worked on systems with 32 reserved sectors since the modulo
operation "masked" the error, because the FAT cache size happens to be
32 as well. On file systems 36 reserved sectors, the wrong cache entry
would be set to dirty, and the updated entry would never be flushed to disk.
Received on 2003-03-05