• Status Closed
  • Percent Complete
  • Task Type Bugs
  • Category
  • Assigned To No-one
  • Operating System
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by rb_dev - 2003-06-29
Last edited by linusnielsen - 2004-11-05

FS#1481 - Possible bug in fat.c

I posted this to the mailing list for comment but got
no response, so I am turning it into an official bug

At line 406 of fat.c, inside of function fat_mount()
is this bit of code :

/* calculate freecount if unset */
if ( fat_bpb.fsinfo.freecount == 0xffffffff )



There seems to be something wrong with calling
fat_recalc_free() from this point. When I modified the
if statement so that fat_recalc_free() was always
called, something is amiss.

When fat_recalc_free() gets called during the disk
mount at bootup, the lcd backlight goes off while the
fat recalc is taking place and then comes back on. I
have a long backlight timeout so it’s not the normal
backlight timeout.

When fat_recalc_free() is called during the disk mount
at the end of a USB session it’s even worse. Rockbox
crashes with the following display:

at 0002FDA0

Even in the case when it doesn’t crash, the fact that
the lcd backlight goes off and on indicates that
something isn’t right with either execution of this

I know that fat_recalc_free() works when called from
other places because it works OK when it is called
from the debug menu and I also added a call to it from
elsewhere in the code that works OK.

I’m guessing that either this piece of code has never
been exercised and that for some reason there is a
problem with calling fat_recalc_free() from inside
fat_mount() (stack overflow maybe?), or possibly that
I have some strange timing issue with my hardware that
causes the buggy behavior only when called from this
one place in the code.

Closed by  linusnielsen
2004-11-05 07:00
Reason for closing:  Fixed
Project Manager

The settings aren’t read from RTC/disk until after the disk
initialization, hence the short backlight timeout. The crash
when fat_mount() was called from the USB thread was a stack
overflow, as you suspected. I have fixed the crash in CVS,
but I’ll leave the backlight issue for now.


Available keyboard shortcuts


Task Details

Task Editing