Added extra safety checks.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2839 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5a7548afba
commit
099a6b58d1
2 changed files with 7 additions and 1 deletions
|
@ -292,6 +292,9 @@ int ata_write_sectors(unsigned long start,
|
|||
|
||||
last_disk_activity = current_tick;
|
||||
|
||||
if (start == 0)
|
||||
panicf("Writing on sector 0\n");
|
||||
|
||||
mutex_lock(&ata_mtx);
|
||||
|
||||
if ( sleeping ) {
|
||||
|
|
|
@ -1128,8 +1128,11 @@ static bool transfer( int start, int count, char* buf, bool write )
|
|||
int err;
|
||||
|
||||
LDEBUGF("transfer(s=%x, c=%x, %s)\n",start, count, write?"write":"read");
|
||||
if (write)
|
||||
if (write) {
|
||||
if (start < fat_bpb.firstdatasector)
|
||||
panicf("Writing before data\n");
|
||||
err = ata_write_sectors(start, count, buf);
|
||||
}
|
||||
else
|
||||
err = ata_read_sectors(start, count, buf);
|
||||
if (err) {
|
||||
|
|
Loading…
Reference in a new issue